Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. `timescale 1ns / 1ps
  2. module count_leading_zeros(x, nlz);
  3. input [11:0] x;
  4. output wire [3:0] nlz;
  5. assign nlz =
  6. (x[11]) ? 4'd0 :
  7. ((x[10]) ? 4'd1 :
  8. ((x[9]) ? 4'd2 :
  9. ((x[8]) ? 4'd3 :
  10. ((x[7]) ? 4'd4 :
  11. ((x[6]) ? 4'd5 :
  12. ((x[5]) ? 4'd6 :
  13. ((x[4]) ? 4'd7 : 4'd8 )))))));
  14. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement