Advertisement
STANAANDREY

aclab3 pb3

Oct 11th, 2023 (edited)
1,063
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module cnt1s (
  2.   input [5:0] i,
  3.   output reg [2:0] o
  4. );
  5.     always @(*)
  6.     o = i[5]+i[4]+i[3]+i[2]+i[1]+i[0];
  7. endmodule
  8.  
  9. module cnt1s_tb;
  10.   reg [5:0] i;
  11.   wire [2:0] o;
  12.  
  13.   cnt1s cnt1s_i (.i(i), .o(o));
  14.  
  15.   integer k;
  16.   initial begin
  17.     $display("Time\ti\t\to");
  18.     $monitor("%0t\t%b(%2d)\t%b(%0d)", $time, i, i, o, o);
  19.     i = 0;
  20.     for (k = 1; k < 64; k = k + 1)
  21.       #10 i = k;
  22.   end
  23. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement