Last active
April 17, 2023 12:17
-
-
Save smirnovich/1d03168da0a0627c08768b8a16f8d873 to your computer and use it in GitHub Desktop.
simple priority encoder on SystemVerilog to check if it is synthesizable in different software
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`timescale 1ns / 1ps | |
module prior_encod( | |
input logic [11:0] sw, | |
output logic [3:0] leds | |
); | |
always_comb begin | |
if (sw == 12'b0) begin | |
leds = 4'b0; | |
end else begin | |
for(int i=0;i<12;i++) begin | |
if (sw[i] == 1'b1) begin | |
leds = i; | |
end | |
end | |
end | |
end | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment