Advertisement
itsme_rudj

Priority Encoder Structure

Dec 8th, 2023
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VeriLog 0.28 KB | Source Code | 0 0
  1. module priority (W, Y ,Z);
  2.     input [3:0] W;
  3.     output reg [1:0]Y;
  4.     output reg Z;
  5.     integer k;
  6.     always @ (W)
  7.         begin
  8.         Y = 2'bx;
  9.         Z = 0;
  10.         for (k = 0 ; k < 4 ; k = k+1)
  11.         if(W[k])
  12.             begin
  13.                 Y = k;
  14.             Z = 1;
  15.             end
  16.     end
  17. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement