Facebook
From ryan, 2 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 191
  1.     // Test stimulus
  2.     initial begin
  3.         // Initialize inputs
  4.         operand1 = 32'h12345678;
  5.         operand2 = 32'h87654321;
  6.  
  7.         // Test LD (Load) operation
  8.         operation_select = 5'b00001; // LD
  9.         #20;
  10.        
  11.         // Test ADD operation
  12.         operation_select = 5'b00011; // ADD
  13.         operand1 = 32'h80000000; // Negative number
  14.         operand2 = 32'h80000000; // Negative number
  15.         #20;
  16.        
  17.         // Test SUB operation
  18.         operation_select = 5'b00100; // SUB
  19.         operand1 = 32'h12345678;
  20.         operand2 = 32'h87654321;
  21.         #20;
  22.        
  23.         // Test AND operation
  24.         operation_select = 5'b00101; // AND
  25.         operand1 = 32'hAAAAAAAA;
  26.         operand2 = 32'h55555555;
  27.         #20;
  28.        
  29.         // Test OR operation
  30.         operation_select = 5'b00110; // OR
  31.         operand1 = 32'hAAAAAAAA;
  32.         operand2 = 32'h55555555;
  33.         #20;
  34.        
  35.         // Test XOR operation
  36.         operation_select = 5'b00111; // XOR
  37.         operand1 = 32'hAAAAAAAA;
  38.         operand2 = 32'h55555555;
  39.         #20;
  40.        
  41.         // Test INV operation
  42.         operation_select = 5'b01000; // INV
  43.         operand1 = 32'h12345678;
  44.         #20;
  45.        
  46.         // Test SHL operation
  47.         operation_select = 5'b01001; // SHL
  48.         operand1 = 32'h12345678;
  49.         operand2 = 5'h05; // Shift by 5 bits
  50.         #20;
  51.        
  52.         // Test SHR operation
  53.         operation_select = 5'b01010; // SHR
  54.         operand1 = 32'h12345678;
  55.         operand2 = 5'h05; // Shift by 5 bits
  56.         #20;
  57.        
  58.         // End simulation
  59.         $finish;
  60.     end
  61.  
  62. endmodule