Advertisement
STANAANDREY

aclab3 pb1

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