Advertisement
Guest User

Untitled

a guest
Jul 4th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VeriLog 39.07 KB | None | 0 0
  1. # Starting simulation...
  2. # Done BEQ test...
  3. # Starting R-type test...
  4. # R-type ALUSrcA4
  5. # R-type ALUOp4- expected: 2'b10 actual: 00
  6. # R-type RegDst5
  7. # R-type RegDst6
  8. # R-type RegDst7
  9. # R-type ALUSrcA8
  10. # R-type ALUOp8
  11. # R-type RegDst9
  12. # R-type RegDst2'b10
  13. # R-type RegDst2'b11
  14. # R-type ALUSrcA12
  15. # R-type ALUOp12
  16. # Done R-type test...
  17. # Starting LW test...
  18. # lw RegDst1
  19. # lw RegDst2
  20. # lw RegDst3
  21. # lw RegDst4
  22. # lw lorD5
  23. # lw MemtoReg6
  24. # lw MemtoReg7
  25. # lw MemtoReg8
  26. # lw MemtoReg9
  27. # lw lorD10
  28. # lw MemtoReg11
  29. # lw MemtoReg12
  30. # lw MemtoReg13
  31. # lw MemtoReg14
  32. # lw lorD15
  33. # Done LW test...
  34. # Starting SW test...
  35. # sw MemtoReg1
  36. # sw MemtoReg2
  37. # sw MemtoReg3
  38. # sw MemtoReg4
  39. # sw MemtoReg5
  40. # sw MemtoReg6
  41. # sw MemtoReg7
  42. # sw MemtoReg8
  43. # sw MemtoReg9- expected: 1 actual: 0
  44. # sw MemtoReg10- expected: 1 actual: 0
  45. # sw MemtoReg11- expected: 0 actual 0
  46. # sw MemtoReg12- expected: 1 actual: 0
  47. # Done SW test...
  48. # Starting J test...
  49. # j MemtoReg1- expected: 1 actual: 0
  50. # j MemtoReg2- expected: 1 actual: 0
  51. # j ALUSrcB3- expected: 2'b11 actual: 00
  52. # j MemtoReg3- expected: 1 actual: 0
  53.  
  54.  
  55. module test_controller_2;
  56.  
  57. reg [5:0] Op;
  58. reg Clk;
  59. wire [1:0] ALUOp, ALUSrcB, PCSource;
  60. wire PCWriteCond, PCWrite, lorD, MemRead, MemWrite, MemtoReg, IRWrite, ALUSrcA, RegWrite, RegDst;
  61.  
  62.   controller U0 (
  63.   .Op      (Op),
  64.   .Clk     (Clk),
  65.   .ALUOp   (ALUOp),
  66.   .ALUSrcB  (ALUSrcB),
  67.   .PCSource    (PCSource),
  68.   .PCWriteCond  (PCWriteCond),
  69.   .PCWrite (PCWrite),
  70.   .lorD  (lorD),
  71.   .MemRead    (MemRead),
  72.   .MemWrite  (MemWrite),
  73.   .MemtoReg (MemtoReg),
  74.   .IRWrite  (IRWrite) ,
  75.   .ALUSrcA  (ALUSrcA),
  76.   .RegWrite (RegWrite),
  77.   .RegDst  (RegDst)
  78.   );
  79.  
  80.  
  81. initial begin
  82.   Clk = 0;
  83.   Op = 6'h04;
  84.   $display("Starting simulation...");
  85.   #1;   // s0
  86.   if(MemRead !== 1)  $display("BEQ MemRead1");
  87.   if(ALUSrcA !== 0) $display("BEQ ALUSrcA1");
  88.   if(lorD !== 0)  $display("BEQ lorD1");
  89.   if(IRWrite !== 1)  $display("BEQ IRWrite1");
  90.   if(ALUSrcB !== 2'b01) $display("BEQ ALUSrcB1");
  91.   if(ALUOp !== 2'b00)  $display("BEQ ALUOp1");
  92.   if(PCWrite !== 1)  $display("BEQ PCWrite1");
  93.   if(PCSource !== 2'b00)  $display("BEQ PCSource1");
  94.   if(PCWriteCond !== 0) $display("BEQ PCWriteCond1");
  95.   #2;   // s1
  96.   if(MemRead !== 0)  $display("BEQ MemRead2");
  97.   if(ALUSrcA !== 0) $display("BEQ ALUSrcA2");
  98.   if(lorD !== 0)  $display("BEQ lorD2");
  99.   if(IRWrite !== 0)  $display("BEQ IRWrite2");
  100.   if(ALUSrcB !== 2'b11) $display("BEQ ALUSrcB2");
  101.   if(ALUOp !== 2'b00)  $display("BEQ ALUOp2");
  102.   if(PCWrite !== 0)  $display("BEQ PCWrite2");
  103.   if(PCSource !== 2'b00)  $display("BEQ PCSource2");
  104.   if(PCWriteCond !== 0) $display("BEQ PCWriteCond2");
  105.   #2;   // s8
  106.   if(MemRead !== 0)  $display("BEQ MemRead3");
  107.   if(ALUSrcA !== 1) $display("BEQ ALUSrcA3");
  108.   if(lorD !== 0)  $display("BEQ lorD3");
  109.   if(IRWrite !== 0)  $display("BEQ IRWrite3");
  110.   if(ALUSrcB !== 2'b00) $display("BEQ ALUSrcB3");
  111.   if(ALUOp !== 2'b01)  $display("BEQ ALUOp3");
  112.   if(PCWrite !== 0)  $display("BEQ PCWrite3");
  113.   if(PCSource !== 2'b01)  $display("BEQ PCSource3");
  114.   if(PCWriteCond !== 1) $display("BEQ PCWriteCond3");
  115.   #2;   // s0
  116.   if(MemRead !== 1)  $display("BEQ MemRead4");
  117.   if(ALUSrcA !== 0) $display("BEQ ALUSrcA4");
  118.   if(lorD !== 0)  $display("BEQ lorD4");
  119.   if(IRWrite !== 1)  $display("BEQ IRWrite4");
  120.   if(ALUSrcB !== 2'b01) $display("BEQ ALUSrcB4");
  121.   if(ALUOp !== 2'b00)  $display("BEQ ALUOp4");
  122.   if(PCWrite !== 1)  $display("BEQ PCWrite4");
  123.   if(PCSource !== 2'b00)  $display("BEQ PCSource4");
  124.   if(PCWriteCond !== 0) $display("BEQ PCWriteCond4");
  125.   #2;   // s1
  126.   if(MemRead !== 0)  $display("BEQ MemRead5");
  127.   if(ALUSrcA !== 0) $display("BEQ ALUSrcA5");
  128.   if(lorD !== 0)  $display("BEQ lorD5");
  129.   if(IRWrite !== 0)  $display("BEQ IRWrite5");
  130.   if(ALUSrcB !== 2'b11) $display("BEQ ALUSrcB5");
  131.   if(ALUOp !== 2'b00)  $display("BEQ 5");
  132.   if(PCWrite !== 0)  $display("BEQ PCWrite5");
  133.   if(PCSource !== 2'b00)  $display("BEQ PCSource5");
  134.   if(PCWriteCond !== 0) $display("BEQ PCWriteCond5");
  135.   #2;   // s8
  136.   if(MemRead !== 0)  $display("BEQ MemRead6");
  137.   if(ALUSrcA !== 1) $display("BEQ ALUSrcA6");
  138.   if(lorD !== 0)  $display("BEQ lorD6");
  139.   if(IRWrite !== 0)  $display("BEQ IRWrite6");
  140.   if(ALUSrcB !== 2'b00) $display("BEQ ALUSrcB6");
  141.   if(ALUOp !== 2'b01)  $display("BEQ ALUOp6");
  142.   if(PCWrite !== 0)  $display("BEQ PCWrite6");
  143.   if(PCSource !== 2'b01)  $display("BEQ PCSource6");
  144.   if(PCWriteCond !== 1) $display("BEQ PCWriteCond6");
  145.  
  146.   #1;   // s0
  147.   if(MemRead !== 1)  $display("BEQ MemRead7");
  148.   if(ALUSrcA !== 0) $display("BEQ ALUSrcA7");
  149.   if(lorD !== 0)  $display("BEQ lorD7");
  150.   if(IRWrite !== 1)  $display("BEQ IRWrite7");
  151.   if(ALUSrcB !== 2'b01) $display("BEQ ALUSrcB7");
  152.   if(ALUOp !== 2'b00)  $display("BEQ ALUOp7");
  153.   if(PCWrite !== 1)  $display("BEQ PCWrite7");
  154.   if(PCSource !== 2'b00)  $display("BEQ PCSource7");
  155.   if(PCWriteCond !== 0) $display("BEQ PCWriteCond7");
  156.   #2;   // s1
  157.   if(MemRead !== 0)  $display("BEQ MemRead8");
  158.   if(ALUSrcA !== 0) $display("BEQ ALUSrcA8");
  159.   if(lorD !== 0)  $display("BEQ lorD8");
  160.   if(IRWrite !== 0)  $display("BEQ IRWrite8");
  161.   if(ALUSrcB !== 2'b11) $display("BEQ ALUSrcB8");
  162.   if(ALUOp !== 2'b00)  $display("BEQ ALUOp8");
  163.   if(PCWrite !== 0)  $display("BEQ PCWrite8");
  164.   if(PCSource !== 2'b00)  $display("BEQ PCSource8");
  165.   if(PCWriteCond !== 0) $display("BEQ PCWriteCond8");
  166.   #2;   // s8
  167.   if(MemRead !== 0)  $display("BEQ MemRead9");
  168.   if(ALUSrcA !== 1) $display("BEQ ALUSrcA9");
  169.   if(lorD !== 0)  $display("BEQ lorD9");
  170.   if(IRWrite !== 0)  $display("BEQ IRWrite9");
  171.   if(ALUSrcB !== 2'b00) $display("BEQ ALUSrcB9");
  172.   if(ALUOp !== 2'b01)  $display("BEQ ALUOp9");
  173.   if(PCWrite !== 0)  $display("BEQ PCWrite9");
  174.   if(PCSource !== 2'b01)  $display("BEQ PCSource9");
  175.   if(PCWriteCond !== 1) $display("BEQ PCWriteCond9");
  176.   $display("Done BEQ test...");
  177.  
  178.  
  179.   Op = 6'h00;   // r-type
  180.   $display("Starting R-type test...");
  181.   #2;   //s0
  182.   if(MemRead !== 1)  $display("R-type MemRead1");
  183.   if(ALUSrcA !== 0) $display("R-type ALUSrcA1");
  184.   if(lorD !== 0)  $display("R-type lorD1");
  185.   if(IRWrite !== 1)  $display("R-type IRWrite1");
  186.   if(ALUSrcB !== 2'b01) $display("R-type ALUSrcB1");
  187.   if(ALUOp !== 2'b00)  $display("R-type ALUOp1");
  188.   if(PCWrite !== 1)  $display("R-type PCWrite1");
  189.   if(PCSource !== 2'b00)  $display("R-type PCSource1");
  190.   if(PCWriteCond !== 0) $display("R-type PCWriteCond1");
  191.   #2;   //s1
  192.   if(MemRead !== 0)  $display("R-type MemRead2");
  193.   if(ALUSrcA !== 0) $display("R-type ALUSrcA2");
  194.   if(lorD !== 0)  $display("R-type lorD2");
  195.   if(IRWrite !== 0)  $display("R-type IRWrite2");
  196.   if(ALUSrcB !== 2'b11) $display("R-type ALUSrcB2");
  197.   if(ALUOp !== 2'b00)  $display("R-type ALUOp2");
  198.   if(PCWrite !== 0)  $display("R-type PCWrite2");
  199.   if(PCSource !== 2'b00)  $display("R-type PCSource2");
  200.   if(PCWriteCond !== 0) $display("R-type PCWriteCond2");
  201.   #2;   //s6
  202.   if(MemRead !== 0)  $display("R-type MemRead3");
  203.   if(ALUSrcA !== 1) $display("R-type ALUSrcA3");
  204.   if(lorD !== 0)  $display("R-type lorD3");
  205.   if(IRWrite !== 0)  $display("R-type IRWrite3");
  206.   if(ALUSrcB !== 2'b00) $display("R-type ALUSrcB3");
  207.   if(ALUOp !== 2'b10)  $display("R-type ALUOp3- expected: 2'b10 actual: %b", ALUOp);
  208.   if(PCWrite !== 0)  $display("R-type PCWrite3");
  209.   if(PCSource !== 2'b00)  $display("R-type PCSource3");
  210.   if(PCWriteCond !== 0) $display("R-type PCWriteCond3");
  211.   #2;   //s7
  212.   if(MemRead !== 0)  $display("R-type MemRead4");
  213.   if(ALUSrcA !== 1) $display("R-type ALUSrcA4");
  214.   if(lorD !== 0)  $display("R-type lorD4");
  215.   if(IRWrite !== 0)  $display("R-type IRWrite4");
  216.   if(ALUSrcB !== 2'b00) $display("R-type ALUSrcB4");
  217.   if(ALUOp !== 2'b10)  $display("R-type ALUOp4- expected: 2'b10 actual: %b", ALUOp);
  218.   if(PCWrite !== 0)  $display("R-type PCWrite4");
  219.   if(PCSource !== 2'b00)  $display("R-type PCSource4");
  220.   if(RegDst !== 1) $display("R-type RegDst4");
  221.   if(RegWrite !== 1) $display("R-type RegWrite4");
  222.   if(MemtoReg !== 0) $display("R-type MemtoReg4");
  223.   if(PCWriteCond !== 0) $display("R-type PCWriteCond4");
  224.   #2;   //s0
  225.   if(MemRead !== 1)  $display("R-type MemRead5");
  226.   if(ALUSrcA !== 0) $display("R-type ALUSrcA5");
  227.   if(lorD !== 0)  $display("R-type lorD5");
  228.   if(IRWrite !== 1)  $display("R-type IRWrite5");
  229.   if(ALUSrcB !== 2'b01) $display("R-type ALUSrcB5");
  230.   if(ALUOp !== 2'b00)  $display("R-type ALUOp5");
  231.   if(PCWrite !== 1)  $display("R-type PCWrite5");
  232.   if(PCSource !== 2'b00)  $display("R-type PCSource5");
  233.   if(RegDst !== 1) $display("R-type RegDst5");
  234.   if(RegWrite !== 0) $display("R-type RegWrite5");
  235.   if(MemtoReg !== 0) $display("R-type MemtoReg5");
  236.   if(PCWriteCond !== 0) $display("R-type PCWriteCond5");
  237.   #2;    //s1
  238.   if(MemRead !== 0)  $display("R-type MemRead6");
  239.   if(ALUSrcA !== 0) $display("R-type ALUSrcA6");
  240.   if(lorD !== 0)  $display("R-type lorD6");
  241.   if(IRWrite !== 0)  $display("R-type IRWrite6");
  242.   if(ALUSrcB !== 2'b11) $display("R-type ALUSrcB6");
  243.   if(ALUOp !== 2'b00)  $display("R-type ALUOp6");
  244.   if(PCWrite !== 0)  $display("R-type PCWrite6");
  245.   if(PCSource !== 2'b00)  $display("R-type PCSource6");
  246.   if(RegDst !== 1) $display("R-type RegDst6");
  247.   if(RegWrite !== 0) $display("R-type RegWrite6");
  248.   if(MemtoReg !== 0) $display("R-type MemtoReg6");
  249.   if(PCWriteCond !== 0) $display("R-type PCWriteCond6");
  250.   #2;     //s6
  251.   if(MemRead !== 0)  $display("R-type MemRead7");
  252.   if(ALUSrcA !== 1) $display("R-type ALUSrcA7");
  253.   if(lorD !== 0)  $display("R-type lorD7");
  254.   if(IRWrite !== 0)  $display("R-type IRWrite7");
  255.   if(ALUSrcB !== 2'b00) $display("R-type ALUSrcB7");
  256.   if(ALUOp !== 2'b10)  $display("R-type ALUOp7");
  257.   if(PCWrite !== 0)  $display("R-type PCWrite7");
  258.   if(PCSource !== 2'b00)  $display("R-type PCSource7");
  259.   if(RegDst !== 1) $display("R-type RegDst7");
  260.   if(RegWrite !== 0) $display("R-type RegWrite7");
  261.   if(MemtoReg !== 0) $display("R-type MemtoReg7");
  262.   if(PCWriteCond !== 0) $display("R-type PCWriteCond7");
  263.   #2;   //s7
  264.   if(MemRead !== 0)  $display("R-type MemRead8");
  265.   if(ALUSrcA !== 1) $display("R-type ALUSrcA8");
  266.   if(lorD !== 0)  $display("R-type lorD8");
  267.   if(IRWrite !== 0)  $display("R-type IRWrite8");
  268.   if(ALUSrcB !== 2'b00) $display("R-type ALUSrcB8");
  269.   if(ALUOp !== 2'b10)  $display("R-type ALUOp8");
  270.   if(PCWrite !== 0)  $display("R-type PCWrite8");
  271.   if(PCSource !== 2'b00)  $display("R-type PCSource8");
  272.   if(RegDst !== 1) $display("R-type RegDst8");
  273.   if(RegWrite !== 1) $display("R-type RegWrite8");
  274.   if(MemtoReg !== 0) $display("R-type MemtoReg8");
  275.   if(PCWriteCond !== 0) $display("R-type PCWriteCond8");
  276.   #2;   //s0
  277.   if(MemRead !== 1)  $display("R-type MemRead9");
  278.   if(ALUSrcA !== 0) $display("R-type ALUSrcA9");
  279.   if(lorD !== 0)  $display("R-type lorD9");
  280.   if(IRWrite !== 1)  $display("R-type IRWrite9");
  281.   if(ALUSrcB !== 2'b01) $display("R-type ALUSrcB9");
  282.   if(ALUOp !== 2'b00)  $display("R-type ALUOp9");
  283.   if(PCWrite !== 1)  $display("R-type PCWrite9");
  284.   if(PCSource !== 2'b00)  $display("R-type PCSource9");
  285.   if(RegDst !== 1) $display("R-type RegDst9");
  286.   if(RegWrite !== 0) $display("R-type RegWrite9");
  287.   if(MemtoReg !== 0) $display("R-type MemtoReg9");
  288.   if(PCWriteCond !== 0) $display("R-type PCWriteCond9");
  289.   #2;    //s1
  290.   if(MemRead !== 0)  $display("R-type MemRead2'b10");
  291.   if(ALUSrcA !== 0) $display("R-type ALUSrcA2'b10");
  292.   if(lorD !== 0)  $display("R-type lorD2'b10");
  293.   if(IRWrite !== 0)  $display("R-type IRWrite2'b10");
  294.   if(ALUSrcB !== 2'b11) $display("R-type ALUSrcB2'b10");
  295.   if(ALUOp !== 2'b00)  $display("R-type ALUOp2'b10");
  296.   if(PCWrite !== 0)  $display("R-type PCWrite2'b10");
  297.   if(PCSource !== 2'b00)  $display("R-type PCSource2'b10");
  298.   if(RegDst !== 1) $display("R-type RegDst2'b10");
  299.   if(RegWrite !== 0) $display("R-type RegWrite2'b10");
  300.   if(MemtoReg !== 0) $display("R-type MemtoReg2'b10");
  301.   if(PCWriteCond !== 0) $display("R-type PCWriteCond2'b10");
  302.   #2;     //s6
  303.   if(MemRead !== 0)  $display("R-type MemRead2'b11");
  304.   if(ALUSrcA !== 1) $display("R-type ALUSrcA2'b11");
  305.   if(lorD !== 0)  $display("R-type lorD2'b11");
  306.   if(IRWrite !== 0)  $display("R-type IRWrite2'b11");
  307.   if(ALUSrcB !== 2'b00) $display("R-type ALUSrcB2'b11");
  308.   if(ALUOp !== 2'b10)  $display("R-type ALUOp2'b11");
  309.   if(PCWrite !== 0)  $display("R-type PCWrite2'b11");
  310.   if(PCSource !== 2'b00)  $display("R-type PCSource2'b11");
  311.   if(RegDst !== 1) $display("R-type RegDst2'b11");
  312.   if(RegWrite !== 0) $display("R-type RegWrite2'b11");
  313.   if(MemtoReg !== 0) $display("R-type MemtoReg2'b11");
  314.   if(PCWriteCond !== 0) $display("R-type PCWriteCond2'b11");
  315.   #2;    //s7
  316.   if(MemRead !== 0)  $display("R-type MemRead12");
  317.   if(ALUSrcA !== 1) $display("R-type ALUSrcA12");
  318.   if(lorD !== 0)  $display("R-type lorD12");
  319.   if(IRWrite !== 0)  $display("R-type IRWrite12");
  320.   if(ALUSrcB !== 2'b00) $display("R-type ALUSrcB12");
  321.   if(ALUOp !== 2'b10)  $display("R-type ALUOp12");
  322.   if(PCWrite !== 0)  $display("R-type PCWrite12");
  323.   if(PCSource !== 2'b00)  $display("R-type PCSource12");
  324.   if(RegDst !== 1) $display("R-type RegDst12");
  325.   if(RegWrite !== 1) $display("R-type RegWrite12");
  326.   if(MemtoReg !== 0) $display("R-type MemtoReg12");
  327.   if(PCWriteCond !== 0) $display("R-type PCWriteCond12");
  328.   $display("Done R-type test...");
  329.   #1;
  330.  
  331.   Op = 6'h23;   // lw
  332.   $display("Starting LW test...");
  333.   #1;   //s0
  334.   if(MemRead !== 1)  $display("lw MemRead1");
  335.   if(ALUSrcA !== 0) $display("lw ALUSrcA1");
  336.   if(lorD !== 0)  $display("lw lorD1");
  337.   if(IRWrite !== 1)  $display("lw IRWrite1");
  338.   if(ALUSrcB !== 2'b01) $display("lw ALUSrcB1");
  339.   if(ALUOp !== 2'b00)  $display("lw ALUOp1");
  340.   if(PCWrite !== 1)  $display("lw PCWrite1");
  341.   if(PCSource !== 2'b00)  $display("lw PCSource1");
  342.   if(RegDst !== 1) $display("lw RegDst1");
  343.   if(RegWrite !== 0) $display("lw RegWrite1");
  344.   if(MemtoReg !== 0) $display("lw MemtoReg1");
  345.   if(PCWriteCond !== 0) $display("lw PCWriteCond1");
  346.   #2;   //s1
  347.   if(MemRead !== 0)  $display("lw MemRead2");
  348.   if(ALUSrcA !== 0) $display("lw ALUSrcA2");
  349.   if(lorD !== 0)  $display("lw lorD2");
  350.   if(IRWrite !== 0)  $display("lw IRWrite2");
  351.   if(ALUSrcB !== 2'b11) $display("lw ALUSrcB2");
  352.   if(ALUOp !== 2'b00)  $display("lw ALUOp2");
  353.   if(PCWrite !== 0)  $display("lw PCWrite2");
  354.   if(PCSource !== 2'b00)  $display("lw PCSource2");
  355.   if(RegDst !== 1) $display("lw RegDst2");
  356.   if(RegWrite !== 0) $display("lw RegWrite2");
  357.   if(MemtoReg !== 0) $display("lw MemtoReg2");
  358.   if(PCWriteCond !== 0) $display("lw PCWriteCond2");
  359.   #2;   //s2
  360.   if(MemRead !== 0)  $display("lw MemRead3");
  361.   if(ALUSrcA !== 1) $display("lw ALUSrcA3");
  362.   if(lorD !== 0)  $display("lw lorD3");
  363.   if(IRWrite !== 0)  $display("lw IRWrite3");
  364.   if(ALUSrcB !== 2'b10) $display("lw ALUSrcB3");
  365.   if(ALUOp !== 2'b00)  $display("lw ALUOp3");
  366.   if(PCWrite !== 0)  $display("lw PCWrite3");
  367.   if(PCSource !== 2'b00)  $display("lw PCSource3");
  368.   if(RegDst !== 1) $display("lw RegDst3");
  369.   if(RegWrite !== 0) $display("lw RegWrite3");
  370.   if(MemtoReg !== 0) $display("lw MemtoReg3");
  371.   if(PCWriteCond !== 0) $display("lw PCWriteCond3");
  372.   #2;   //s3
  373.   if(MemRead !== 1)  $display("lw MemRead4");
  374.   if(ALUSrcA !== 1) $display("lw ALUSrcA4");
  375.   if(lorD !== 1)  $display("lw lorD4");
  376.   if(IRWrite !== 0)  $display("lw IRWrite4");
  377.   if(ALUSrcB !== 2'b10) $display("lw ALUSrcB4");
  378.   if(ALUOp !== 2'b00)  $display("lw ALUOp4");
  379.   if(PCWrite !== 0)  $display("lw PCWrite4");
  380.   if(PCSource !== 2'b00)  $display("lw PCSource4");
  381.   if(RegDst !== 1) $display("lw RegDst4");
  382.   if(RegWrite !== 0) $display("lw RegWrite4");
  383.   if(MemtoReg !== 0) $display("lw MemtoReg4");
  384.   if(PCWriteCond !== 0) $display("lw PCWriteCond4");
  385.   #2;   //s4
  386.   if(MemRead !== 0)  $display("lw MemRead5");      // TODO: remove test
  387.   if(ALUSrcA !== 1) $display("lw ALUSrcA5");
  388.   if(lorD !== 1)  $display("lw lorD5");
  389.   if(IRWrite !== 0)  $display("lw IRWrite5");
  390.   if(ALUSrcB !== 2'b10) $display("lw ALUSrcB5");
  391.   if(ALUOp !== 2'b00)  $display("lw ALUOp5");
  392.   if(PCWrite !== 0)  $display("lw PCWrite5");
  393.   if(PCSource !== 2'b00)  $display("lw PCSource5");
  394.   if(RegDst !== 0) $display("lw RegDst5");
  395.   if(RegWrite !== 1) $display("lw RegWrite5");
  396.   if(MemtoReg !== 1) $display("lw MemtoReg5"); // TODO: turn on memread
  397.   if(PCWriteCond !== 0) $display("lw PCWriteCond5");
  398.  
  399.   #2;   //s0
  400.   if(MemRead !== 1)  $display("lw MemRead6");
  401.   if(ALUSrcA !== 0) $display("lw ALUSrcA6");
  402.   if(lorD !== 0)  $display("lw lorD6");
  403.   if(IRWrite !== 1)  $display("lw IRWrite6");
  404.   if(ALUSrcB !== 2'b01) $display("lw ALUSrcB6");
  405.   if(ALUOp !== 2'b00)  $display("lw ALUOp6");
  406.   if(PCWrite !== 1)  $display("lw PCWrite6");
  407.   if(PCSource !== 2'b00)  $display("lw PCSource6");
  408.   if(RegDst !== 0) $display("lw RegDst6");
  409.   if(RegWrite !== 0) $display("lw RegWrite6");
  410.   if(MemtoReg !== 1) $display("lw MemtoReg6");
  411.   if(PCWriteCond !== 0) $display("lw PCWriteCond6");
  412.   #2;   //s1
  413.   if(MemRead !== 0)  $display("lw MemRead7");
  414.   if(ALUSrcA !== 0) $display("lw ALUSrcA7");
  415.   if(lorD !== 0)  $display("lw lorD7");
  416.   if(IRWrite !== 0)  $display("lw IRWrite7");
  417.   if(ALUSrcB !== 2'b11) $display("lw ALUSrcB7");
  418.   if(ALUOp !== 2'b00)  $display("lw ALUOp7");
  419.   if(PCWrite !== 0)  $display("lw PCWrite7");
  420.   if(PCSource !== 2'b00)  $display("lw PCSource7");
  421.   if(RegDst !== 0) $display("lw RegDst7");
  422.   if(RegWrite !== 0) $display("lw RegWrite7");
  423.   if(MemtoReg !== 1) $display("lw MemtoReg7");
  424.   if(PCWriteCond !== 0) $display("lw PCWriteCond7");
  425.   #2;   //s2
  426.   if(MemRead !== 0)  $display("lw MemRead8");
  427.   if(ALUSrcA !== 1) $display("lw ALUSrcA8");
  428.   if(lorD !== 0)  $display("lw lorD8");
  429.   if(IRWrite !== 0)  $display("lw IRWrite8");
  430.   if(ALUSrcB !== 2'b10) $display("lw ALUSrcB8");
  431.   if(ALUOp !== 2'b00)  $display("lw ALUOp8");
  432.   if(PCWrite !== 0)  $display("lw PCWrite8");
  433.   if(PCSource !== 2'b00)  $display("lw PCSource8");
  434.   if(RegDst !== 0) $display("lw RegDst8");
  435.   if(RegWrite !== 0) $display("lw RegWrite8");
  436.   if(MemtoReg !== 1) $display("lw MemtoReg8");
  437.   if(PCWriteCond !== 0) $display("lw PCWriteCond8");
  438.   #2;   //s3
  439.   if(MemRead !== 1)  $display("lw MemRead9");
  440.   if(ALUSrcA !== 1) $display("lw ALUSrcA9");
  441.   if(lorD !== 1)  $display("lw lorD9");
  442.   if(IRWrite !== 0)  $display("lw IRWrite9");
  443.   if(ALUSrcB !== 2'b10) $display("lw ALUSrcB9");
  444.   if(ALUOp !== 2'b00)  $display("lw ALUOp9");
  445.   if(PCWrite !== 0)  $display("lw PCWrite9");
  446.   if(PCSource !== 2'b00)  $display("lw PCSource9");
  447.   if(RegDst !== 0) $display("lw RegDst9");
  448.   if(RegWrite !== 0) $display("lw RegWrite9");
  449.   if(MemtoReg !== 1) $display("lw MemtoReg9");
  450.   if(PCWriteCond !== 0) $display("lw PCWriteCond9");
  451.   #2;   //s4
  452.   if(MemRead !== 0)  $display("lw MemRead10");    // TODO: remove test
  453.   if(ALUSrcA !== 1) $display("lw ALUSrcA10");
  454.   if(lorD !== 1)  $display("lw lorD10");
  455.   if(IRWrite !== 0)  $display("lw IRWrite10");
  456.   if(ALUSrcB !== 2'b10) $display("lw ALUSrcB10");
  457.   if(ALUOp !== 2'b00)  $display("lw ALUOp10");
  458.   if(PCWrite !== 0)  $display("lw PCWrite10");
  459.   if(PCSource !== 2'b00)  $display("lw PCSource10");
  460.   if(RegDst !== 0) $display("lw RegDst10");
  461.   if(RegWrite !== 1) $display("lw RegWrite10");
  462.   if(MemtoReg !== 1) $display("lw MemtoReg10"); // TODO: turn on memread
  463.   if(PCWriteCond !== 0) $display("lw PCWriteCond10");
  464.   #2;   //s0
  465.   if(MemRead !== 1)  $display("lw MemRead11");
  466.   if(ALUSrcA !== 0) $display("lw ALUSrcA11");
  467.   if(lorD !== 0)  $display("lw lorD11");
  468.   if(IRWrite !== 1)  $display("lw IRWrite11");
  469.   if(ALUSrcB !== 2'b01) $display("lw ALUSrcB11");
  470.   if(ALUOp !== 2'b00)  $display("lw ALUOp11");
  471.   if(PCWrite !== 1)  $display("lw PCWrite11");
  472.   if(PCSource !== 2'b00)  $display("lw PCSource11");
  473.   if(RegDst !== 0) $display("lw RegDst11");
  474.   if(RegWrite !== 0) $display("lw RegWrite11");
  475.   if(MemtoReg !== 1) $display("lw MemtoReg11");
  476.   if(PCWriteCond !== 0) $display("lw PCWriteCond11");
  477.   #2;   //s1
  478.   if(MemRead !== 0)  $display("lw MemRead12");
  479.   if(ALUSrcA !== 0) $display("lw ALUSrcA12");
  480.   if(lorD !== 0)  $display("lw lorD12");
  481.   if(IRWrite !== 0)  $display("lw IRWrite12");
  482.   if(ALUSrcB !== 2'b11) $display("lw ALUSrcB12");
  483.   if(ALUOp !== 2'b00)  $display("lw ALUOp12");
  484.   if(PCWrite !== 0)  $display("lw PCWrite12");
  485.   if(PCSource !== 2'b00)  $display("lw PCSource12");
  486.   if(RegDst !== 0) $display("lw RegDst12");
  487.   if(RegWrite !== 0) $display("lw RegWrite12");
  488.   if(MemtoReg !== 1) $display("lw MemtoReg12");
  489.   if(PCWriteCond !== 0) $display("lw PCWriteCond12");
  490.   #2;   //s2
  491.   if(MemRead !== 0)  $display("lw MemRead13");
  492.   if(ALUSrcA !== 1) $display("lw ALUSrcA13");
  493.   if(lorD !== 0)  $display("lw lorD13");
  494.   if(IRWrite !== 0)  $display("lw IRWrite13");
  495.   if(ALUSrcB !== 2'b10) $display("lw ALUSrcB13");
  496.   if(ALUOp !== 2'b00)  $display("lw ALUOp13");
  497.   if(PCWrite !== 0)  $display("lw PCWrite13");
  498.   if(PCSource !== 2'b00)  $display("lw PCSource13");
  499.   if(RegDst !== 0) $display("lw RegDst13");
  500.   if(RegWrite !== 0) $display("lw RegWrite13");
  501.   if(MemtoReg !== 1) $display("lw MemtoReg13");
  502.   if(PCWriteCond !== 0) $display("lw PCWriteCond13");
  503.   #2;   //s3
  504.   if(MemRead !== 1)  $display("lw MemRead14");
  505.   if(ALUSrcA !== 1) $display("lw ALUSrcA14");
  506.   if(lorD !== 1)  $display("lw lorD14");
  507.   if(IRWrite !== 0)  $display("lw IRWrite14");
  508.   if(ALUSrcB !== 2'b10) $display("lw ALUSrcB14");
  509.   if(ALUOp !== 2'b00)  $display("lw ALUOp14");
  510.   if(PCWrite !== 0)  $display("lw PCWrite14");
  511.   if(PCSource !== 2'b00)  $display("lw PCSource14");
  512.   if(RegDst !== 0) $display("lw RegDst14");
  513.   if(RegWrite !== 0) $display("lw RegWrite14");
  514.   if(MemtoReg !== 1) $display("lw MemtoReg14");
  515.   if(PCWriteCond !== 0) $display("lw PCWriteCond14");
  516.   #2;   //s4
  517.   if(MemRead !== 0)  $display("lw MemRead15");
  518.   if(ALUSrcA !== 1) $display("lw ALUSrcA15");
  519.   if(lorD !== 1)  $display("lw lorD15");
  520.   if(IRWrite !== 0)  $display("lw IRWrite15");
  521.   if(ALUSrcB !== 2'b10) $display("lw ALUSrcB15");
  522.   if(ALUOp !== 2'b00)  $display("lw ALUOp15");
  523.   if(PCWrite !== 0)  $display("lw PCWrite15");
  524.   if(PCSource !== 2'b00)  $display("lw PCSource15");
  525.   if(RegDst !== 0) $display("lw RegDst15");
  526.   if(RegWrite !== 1) $display("lw RegWrite15");
  527.   if(MemtoReg !== 1) $display("lw MemtoReg15"); // TODO: turn on memread
  528.   if(PCWriteCond !== 0) $display("lw PCWriteCond15");
  529.   $display("Done LW test...");
  530.   #1;
  531.  
  532.   //TODO: up to here should be updated with flags
  533.  
  534.   Op = 6'h2b;   // sw
  535.   $display("Starting SW test...");
  536.   #1;   //s0
  537.   if(MemRead !== 1)  $display("sw MemRead1");
  538.   if(ALUSrcA !== 0) $display("sw ALUSrcA1");
  539.   if(lorD !== 0)  $display("sw lorD1");
  540.   if(IRWrite !== 1)  $display("sw IRWrite1");
  541.   if(ALUSrcB !== 2'b01) $display("sw ALUSrcB1");
  542.   if(ALUOp !== 2'b00)  $display("sw ALUOp1");
  543.   if(PCWrite !== 1)  $display("sw PCWrite1");
  544.   if(PCSource !== 2'b00)  $display("sw PCSource1");
  545.   if(RegDst !== 0) $display("sw RegDst1");
  546.   if(RegWrite !== 0) $display("sw RegWrite1");
  547.   if(MemtoReg !== 1) $display("sw MemtoReg1");
  548.   #2;   //s1
  549.   if(MemRead !== 0)  $display("sw MemRead2");
  550.   if(ALUSrcA !== 0) $display("sw ALUSrcA2");
  551.   if(lorD !== 0)  $display("sw lorD2");
  552.   if(IRWrite !== 0)  $display("sw IRWrite2");
  553.   if(ALUSrcB !== 2'b11) $display("sw ALUSrcB2");
  554.   if(ALUOp !== 2'b00)  $display("sw ALUOp2");
  555.   if(PCWrite !== 0)  $display("sw PCWrite2");
  556.   if(PCSource !== 2'b00)  $display("sw PCSource2");
  557.   if(RegDst !== 0) $display("sw RegDst2");
  558.   if(RegWrite !== 0) $display("sw RegWrite2");
  559.   if(MemtoReg !== 1) $display("sw MemtoReg2");
  560.   #2;   //s2
  561.   if(MemRead !== 0)  $display("sw MemRead3");
  562.   if(ALUSrcA !== 1) $display("sw ALUSrcA3");
  563.   if(lorD !== 0)  $display("sw lorD3");
  564.   if(IRWrite !== 0)  $display("sw IRWrite3");
  565.   if(ALUSrcB !== 2'b10) $display("sw ALUSrcB3");
  566.   if(ALUOp !== 2'b00)  $display("sw ALUOp3");
  567.   if(PCWrite !== 0)  $display("sw PCWrite3");
  568.   if(PCSource !== 2'b00)  $display("sw PCSource3");
  569.   if(RegDst !== 0) $display("sw RegDst3");
  570.   if(RegWrite !== 0) $display("sw RegWrite3");
  571.   if(MemtoReg !== 1) $display("sw MemtoReg3");
  572.   #2;   //s5
  573.   if(MemRead !== 0)  $display("sw MemRead4");
  574.   if(ALUSrcA !== 1) $display("sw ALUSrcA4");
  575.   if(lorD !== 1)  $display("sw lorD4");
  576.   if(IRWrite !== 0)  $display("sw IRWrite4");
  577.   if(ALUSrcB !== 2'b10) $display("sw ALUSrcB4");
  578.   if(ALUOp !== 2'b00)  $display("sw ALUOp4");
  579.   if(PCWrite !== 0)  $display("sw PCWrite4");
  580.   if(PCSource !== 2'b00)  $display("sw PCSource4");
  581.   if(RegDst !== 0) $display("sw RegDst4");
  582.   if(RegWrite !== 0) $display("sw RegWrite4");
  583.   if(MemtoReg !== 1) $display("sw MemtoReg4");
  584.   if(MemWrite !== 1) $display("sw MemWrite4");
  585.   #2;   //s0
  586.   if(MemRead !== 1)  $display("sw MemRead5");
  587.   if(ALUSrcA !== 0) $display("sw ALUSrcA5");
  588.   if(lorD !== 0)  $display("sw lorD5");
  589.   if(IRWrite !== 1)  $display("sw IRWrite5");
  590.   if(ALUSrcB !== 2'b01) $display("sw ALUSrcB5");
  591.   if(ALUOp !== 2'b00)  $display("sw ALUOp5");
  592.   if(PCWrite !== 1)  $display("sw PCWrite5");
  593.   if(PCSource !== 2'b00)  $display("sw PCSource5");
  594.   if(RegDst !== 0) $display("sw RegDst5");
  595.   if(RegWrite !== 0) $display("sw RegWrite5");
  596.   if(MemtoReg !== 1) $display("sw MemtoReg5");
  597.   if(MemWrite !== 0) $display("sw MemWrite5");
  598.   #2;   //s1
  599.   if(MemRead !== 0)  $display("sw MemRead6");
  600.   if(ALUSrcA !== 0) $display("sw ALUSrcA6");
  601.   if(lorD !== 0)  $display("sw lorD6");
  602.   if(IRWrite !== 0)  $display("sw IRWrite6");
  603.   if(ALUSrcB !== 2'b11) $display("sw ALUSrcB6");
  604.   if(ALUOp !== 2'b00)  $display("sw ALUOp6");
  605.   if(PCWrite !== 0)  $display("sw PCWrite6");
  606.   if(PCSource !== 2'b00)  $display("sw PCSource6");
  607.   if(RegDst !== 0) $display("sw RegDst6");
  608.   if(RegWrite !== 0) $display("sw RegWrite6");
  609.   if(MemtoReg !== 1) $display("sw MemtoReg6");
  610.   if(MemWrite !== 0) $display("sw MemWrite6");
  611.   #2;   //s2
  612.   if(MemRead !== 0)  $display("sw MemRead7");
  613.   if(ALUSrcA !== 1) $display("sw ALUSrcA7");
  614.   if(lorD !== 0)  $display("sw lorD7");
  615.   if(IRWrite !== 0)  $display("sw IRWrite7");
  616.   if(ALUSrcB !== 2'b10) $display("sw ALUSrcB7");
  617.   if(ALUOp !== 2'b00)  $display("sw ALUOp7");
  618.   if(PCWrite !== 0)  $display("sw PCWrite7");
  619.   if(PCSource !== 2'b00)  $display("sw PCSource7");
  620.   if(RegDst !== 0) $display("sw RegDst7");
  621.   if(RegWrite !== 0) $display("sw RegWrite7");
  622.   if(MemtoReg !== 1) $display("sw MemtoReg7");
  623.   if(MemWrite !== 0) $display("sw MemWrite7");
  624.   #2;   //s5
  625.   if(MemRead !== 0)  $display("sw MemRead8");
  626.   if(ALUSrcA !== 1) $display("sw ALUSrcA8");
  627.   if(lorD !== 1)  $display("sw lorD8");
  628.   if(IRWrite !== 0)  $display("sw IRWrite8");
  629.   if(ALUSrcB !== 2'b10) $display("sw ALUSrcB8");
  630.   if(ALUOp !== 2'b00)  $display("sw ALUOp8");
  631.   if(PCWrite !== 0)  $display("sw PCWrite8");
  632.   if(PCSource !== 2'b00)  $display("sw PCSource8");
  633.   if(RegDst !== 0) $display("sw RegDst8");
  634.   if(RegWrite !== 0) $display("sw RegWrite8");
  635.   if(MemtoReg !== 1) $display("sw MemtoReg8");
  636.   if(MemWrite !== 1) $display("sw MemWrite5");
  637.   #2;   //s0
  638.   if(MemRead !== 1)  $display("sw MemRead9- expected: 1 actual: %b", MemRead);
  639.   if(ALUSrcA !== 0) $display("sw ALUSrcA9- expected: 0 actual: %b", ALUSrcA);
  640.   if(lorD !== 0)  $display("sw lorD9- expected: 0 actual: %b", lorD);
  641.   if(IRWrite !== 1)  $display("sw IRWrite9- expected: 1 actual: %b", IRWrite);
  642.   if(ALUSrcB !== 2'b01) $display("sw ALUSrcB9- expected: 2'b01 actual: %b", ALUSrcB);
  643.   if(ALUOp !== 2'b00)  $display("sw ALUOp9- expected: 2'b00 actual: %b", ALUOp);
  644.   if(PCWrite !== 1)  $display("sw PCWrite9- expected: 1 actual: %b", PCWrite);
  645.   if(PCSource !== 2'b00)  $display("sw PCSource9- expected: 2'b00 actual: %b", PCSource);
  646.   if(RegDst !== 0) $display("sw RegDst9- expected: 0 actual: %b", RegDst);
  647.   if(RegWrite !== 0) $display("sw RegWrite9- expected: 0 actual: %b", RegWrite);
  648.   if(MemtoReg !== 1) $display("sw MemtoReg9- expected: 1 actual: %b", MemtoReg);
  649.   if(MemWrite !== 0) $display("sw MemWrite9- expected: 0 actual: %b", MemWrite);
  650.   #2;   //s1
  651.   if(MemRead !== 0)  $display("sw MemRead10- expected: 0 actual: %b", MemRead);
  652.   if(ALUSrcA !== 0) $display("sw ALUSrcA10- expected: 0 actual: %b", ALUSrcA);
  653.   if(lorD !== 0)  $display("sw lorD10- expected: 0 actual: %b", lorD);
  654.   if(IRWrite !== 0)  $display("sw IRWrite10- expected: 0 actual: %b", IRWrite);
  655.   if(ALUSrcB !== 2'b11) $display("sw ALUSrcB10- expected: 2'b11 actual: %b", ALUSrcB);
  656.   if(ALUOp !== 2'b00)  $display("sw ALUOp10- expected: 2'b00 actual: %b", ALUOp);
  657.   if(PCWrite !== 0)  $display("sw PCWrite10- expected: 0 actual: %b", PCWrite);
  658.   if(PCSource !== 2'b00)  $display("sw PCSource10- expected: 2'b00 actual: %b", PCSource);
  659.   if(RegDst !== 0) $display("sw RegDst10- expected: 0 actual: %b", RegDst);
  660.   if(RegWrite !== 0) $display("sw RegWrite10- expected:0 actual: %b", RegWrite);
  661.   if(MemtoReg !== 1) $display("sw MemtoReg10- expected: 1 actual: %b", MemtoReg);
  662.   if(MemWrite !== 0) $display("sw MemWrite10- expected: 0 actual: %b", MemWrite);
  663.   #2;   //s2
  664.   if(MemRead !== 0)  $display("sw MemRead11- expected: 0 actual: %b", MemRead);
  665.   if(ALUSrcA !== 1) $display("sw ALUSrcA11- expected: 1 actual: %b", ALUSrcA);
  666.   if(lorD !== 0)  $display("sw lorD11- expected: 0 actual: %b", lorD);
  667.   if(IRWrite !== 0)  $display("sw IRWrite11- expected: 0 actual: %b", IRWrite);
  668.   if(ALUSrcB !== 2'b10) $display("sw ALUSrcB11- expected:: 2'b10 actual: %b", ALUSrcB);
  669.   if(ALUOp !== 2'b00)  $display("sw ALUOp11- expected: 2'b00 actual: %b", ALUOp);
  670.   if(PCWrite !== 0)  $display("sw PCWrite11- expected: 0 actual: %b", PCWrite);
  671.   if(PCSource !== 2'b00)  $display("sw PCSource11- expected: 2'b00 actual: %b", PCSource);
  672.   if(RegDst !== 0) $display("sw RegDst2'b11- expected: 0 actual: %b", RegDst);
  673.   if(RegWrite !== 0) $display("sw RegWrite11- expected: 0 actual: %b",RegWrite);
  674.   if(MemtoReg !== 1) $display("sw MemtoReg11- expected: 0 actual %b", MemtoReg);
  675.   if(MemWrite !== 0) $display("sw MemWrite11- expected: 0 actual: %b", MemWrite);
  676.   #2;   //s5
  677.   if(MemRead !== 0)  $display("sw MemRead12- expected: 0 actual: %b", MemRead);
  678.   if(ALUSrcA !== 1) $display("sw ALUSrcA12- expected: 1 actual: %b", ALUSrcA);
  679.   if(lorD !== 1)  $display("sw lorD12- expected: 1 actual: %b", lorD);
  680.   if(IRWrite !== 0)  $display("sw IRWrite12- expected: 0 actual: %b", IRWrite);
  681.   if(ALUSrcB !== 2'b10) $display("sw ALUSrcB12- expected 2'b10 actual: %b",ALUSrcB);
  682.   if(ALUOp !== 2'b00)  $display("sw ALUOp12- expected: 2'b00 actual: %b",ALUOp);
  683.   if(PCWrite !== 0)  $display("sw PCWrite12- expected: 0 actual: %b", PCWrite);
  684.   if(PCSource !== 2'b00)  $display("sw PCSource12- expected: 2'b00 actual: %b", PCSource);
  685.   if(RegDst !== 0) $display("sw RegDst12- expected: 0 actual: %b", RegDst);
  686.   if(RegWrite !== 0) $display("sw RegWrite12- expected: 0 actual: %b", RegWrite);
  687.   if(MemtoReg !== 1) $display("sw MemtoReg12- expected: 1 actual: %b", MemtoReg);
  688.   if(MemWrite !== 1) $display("sw MemWrite12- expected: 1 actual: $b", MemWrite);
  689.   $display("Done SW test...");
  690.   #1;
  691.  
  692.   Op = 6'h02;   // j
  693.   $display("Starting J test...");
  694.   #1;   //s0
  695.   if(MemRead !== 1)  $display("j MemRead1- expected: 1 actual: %b", MemRead);
  696.   if(ALUSrcA !== 0) $display("j ALUSrcA1- expected: 0 actual: %b", ALUSrcA);
  697.   if(lorD !== 0)  $display("j lorD1- expected: 0 actual: %b", lorD);
  698.   if(IRWrite !== 1)  $display("j IRWrite1- expected: 1 actual: %b", IRWrite);
  699.   if(ALUSrcB !== 2'b01) $display("j ALUSrcB1- expected: 2'b01 actual: %b", ALUSrcB);
  700.   if(ALUOp !== 2'b00)  $display("j ALUOp1- expected: 2'b00 actual: %b", ALUOp);
  701.   if(PCWrite !== 1)  $display("j PCWrite1- expected: 1 actual: %b", PCWrite);
  702.   if(PCSource !== 2'b00)  $display("j PCSource1- expected: 2'b00 actual: %b", PCSource);
  703.   if(RegDst !== 0) $display("j RegDst1- expected: 0 actual: %b", RegDst);
  704.   if(RegWrite !== 0) $display("j RegWrite1- expected: 0 actual: %b", RegWrite);
  705.   if(MemtoReg !== 1) $display("j MemtoReg1- expected: 1 actual: %b", MemtoReg);
  706.   if(MemWrite !== 0) $display("j MemWrite1- expected: 0 actual: %b", MemWrite);
  707.   #2;   //s1
  708.   if(MemRead !== 0)  $display("j MemRead2- expected: 0 actual: %b", MemRead);
  709.   if(ALUSrcA !== 0) $display("j ALUSrcA2- expected: 0 actual: %b", ALUSrcA);
  710.   if(lorD !== 0)  $display("j lorD2- expected: 0 actual: %b", lorD);
  711.   if(IRWrite !== 0)  $display("j IRWrite2- expected: 0 actual: %b", IRWrite);
  712.   if(ALUSrcB !== 2'b11) $display("j ALUSrcB2- expected: 2'b11 actual: %b", ALUSrcB);
  713.   if(ALUOp !== 2'b00)  $display("j ALUOp2- expected: 2'b00 actual: %b", ALUOp);
  714.   if(PCWrite !== 0)  $display("j PCWrite2- expected: 0 actual: %b", PCWrite);
  715.   if(PCSource !== 2'b00)  $display("j PCSource2- expected: 2'b00 actual: %b", PCSource);
  716.   if(RegDst !== 0) $display("j RegDst2- expected: 0 actual: %b", RegDst);
  717.   if(RegWrite !== 0) $display("j RegWrite2- expected:0 actual: %b", RegWrite);
  718.   if(MemtoReg !== 1) $display("j MemtoReg2- expected: 1 actual: %b", MemtoReg);
  719.   if(MemWrite !== 0) $display("j MemWrite2- expected: 0 actual: %b", MemWrite);
  720.   #2;    //s9
  721.   if(MemRead !== 0)  $display("j MemRead3- expected: 0 actual: %b", MemRead);
  722.   if(ALUSrcA !== 0) $display("j ALUSrcA3- expected: 0 actual: %b", ALUSrcA);
  723.   if(lorD !== 0)  $display("j lorD3- expected: 0 actual: %b", lorD);
  724.   if(IRWrite !== 0)  $display("j IRWrite3- expected: 0 actual: %b", IRWrite);
  725.   if(ALUSrcB !== 2'b11) $display("j ALUSrcB3- expected: 2'b11 actual: %b", ALUSrcB);
  726.   if(ALUOp !== 2'b00)  $display("j ALUOp3- expected: 2'b00 actual: %b", ALUOp);
  727.   if(PCWrite !== 1)  $display("j PCWrite3- expected: 1 actual: %b", PCWrite);
  728.   if(PCSource !== 2'b10)  $display("j PCSource3- expected: 2'b10 actual: %b", PCSource);
  729.   if(RegDst !== 0) $display("j RegDst3- expected: 0 actual: %b", RegDst);
  730.   if(RegWrite !== 0) $display("j RegWrite3- expected:0 actual: %b", RegWrite);
  731.   if(MemtoReg !== 1) $display("j MemtoReg3- expected: 1 actual: %b", MemtoReg);
  732.   if(MemWrite !== 0) $display("j MemWrite3- expected: 0 actual: %b", MemWrite);
  733.   #2;   //s0
  734.   if(MemRead !== 1)  $display("j MemRead4- expected: 1 actual: %b", MemRead);
  735.   if(ALUSrcA !== 0) $display("j ALUSrcA4- expected: 0 actual: %b", ALUSrcA);
  736.   if(lorD !== 0)  $display("j lorD4- expected: 0 actual: %b", lorD);
  737.   if(IRWrite !== 1)  $display("j IRWrite4- expected: 1 actual: %b", IRWrite);
  738.   if(ALUSrcB !== 2'b01) $display("j ALUSrcB4- expected: 2'b01 actual: %b", ALUSrcB);
  739.   if(ALUOp !== 2'b00)  $display("j ALUOp4- expected: 2'b00 actual: %b", ALUOp);
  740.   if(PCWrite !== 1)  $display("j PCWrite4- expected: 1 actual: %b", PCWrite);
  741.   if(PCSource !== 2'b00)  $display("j PCSource4- expected: 2'b00 actual: %b", PCSource);
  742.   if(RegDst !== 0) $display("j RegDst4- expected: 0 actual: %b", RegDst);
  743.   if(RegWrite !== 0) $display("j RegWrite4- expected: 0 actual: %b", RegWrite);
  744.   if(MemtoReg !== 1) $display("j MemtoReg4- expected: 1 actual: %b", MemtoReg);
  745.   if(MemWrite !== 0) $display("j MemWrite4- expected: 0 actual: %b", MemWrite);
  746.   #2;   //s1
  747.   if(MemRead !== 0)  $display("j MemRead5- expected: 0 actual: %b", MemRead);
  748.   if(ALUSrcA !== 0) $display("j ALUSrcA5- expected: 0 actual: %b", ALUSrcA);
  749.   if(lorD !== 0)  $display("j lorD5- expected: 0 actual: %b", lorD);
  750.   if(IRWrite !== 0)  $display("j IRWrite5- expected: 0 actual: %b", IRWrite);
  751.   if(ALUSrcB !== 2'b11) $display("j ALUSrcB5- expected: 2'b11 actual: %b", ALUSrcB);
  752.   if(ALUOp !== 2'b00)  $display("j ALUOp5- expected: 2'b00 actual: %b", ALUOp);
  753.   if(PCWrite !== 0)  $display("j PCWrite5- expected: 0 actual: %b", PCWrite);
  754.   if(PCSource !== 2'b00)  $display("j PCSource5- expected: 2'b00 actual: %b", PCSource);
  755.   if(RegDst !== 0) $display("j RegDst5- expected: 0 actual: %b", RegDst);
  756.   if(RegWrite !== 0) $display("j RegWrite5- expected:0 actual: %b", RegWrite);
  757.   if(MemtoReg !== 1) $display("j MemtoReg5- expected: 1 actual: %b", MemtoReg);
  758.   if(MemWrite !== 0) $display("j MemWrite5- expected: 0 actual: %b", MemWrite);
  759.   #2;    //s9
  760.   if(MemRead !== 0)  $display("j MemRead6- expected: 0 actual: %b", MemRead);
  761.   if(ALUSrcA !== 0) $display("j ALUSrcA6- expected: 0 actual: %b", ALUSrcA);
  762.   if(lorD !== 0)  $display("j lorD6- expected: 0 actual: %b", lorD);
  763.   if(IRWrite !== 0)  $display("j IRWrite6- expected: 0 actual: %b", IRWrite);
  764.   if(ALUSrcB !== 2'b11) $display("j ALUSrcB6- expected: 2'b11 actual: %b", ALUSrcB);
  765.   if(ALUOp !== 2'b00)  $display("j ALUOp6- expected: 2'b00 actual: %b", ALUOp);
  766.   if(PCWrite !== 1)  $display("j PCWrite6- expected: 1 actual: %b", PCWrite);
  767.   if(PCSource !== 2'b10)  $display("j PCSource6- expected: 2'b10 actual: %b", PCSource);
  768.   if(RegDst !== 0) $display("j RegDst6- expected: 0 actual: %b", RegDst);
  769.   if(RegWrite !== 0) $display("j RegWrite6- expected:0 actual: %b", RegWrite);
  770.   if(MemtoReg !== 1) $display("j MemtoReg6- expected: 1 actual: %b", MemtoReg);
  771.   if(MemWrite !== 0) $display("j MemWrite6- expected: 0 actual: %b", MemWrite);
  772.   #2;   //s0
  773.   if(MemRead !== 1)  $display("j MemRead7- expected: 1 actual: %b", MemRead);
  774.   if(ALUSrcA !== 0) $display("j ALUSrcA7- expected: 0 actual: %b", ALUSrcA);
  775.   if(lorD !== 0)  $display("j lorD7- expected: 0 actual: %b", lorD);
  776.   if(IRWrite !== 1)  $display("j IRWrite7- expected: 1 actual: %b", IRWrite);
  777.   if(ALUSrcB !== 2'b01) $display("j ALUSrcB7- expected: 2'b01 actual: %b", ALUSrcB);
  778.   if(ALUOp !== 2'b00)  $display("j ALUOp7- expected: 2'b00 actual: %b", ALUOp);
  779.   if(PCWrite !== 1)  $display("j PCWrite7- expected: 1 actual: %b", PCWrite);
  780.   if(PCSource !== 2'b00)  $display("j PCSource7- expected: 2'b00 actual: %b", PCSource);
  781.   if(RegDst !== 0) $display("j RegDst7- expected: 0 actual: %b", RegDst);
  782.   if(RegWrite !== 0) $display("j RegWrite7- expected: 0 actual: %b", RegWrite);
  783.   if(MemtoReg !== 1) $display("j MemtoReg7- expected: 1 actual: %b", MemtoReg);
  784.   if(MemWrite !== 0) $display("j MemWrite7- expected: 0 actual: %b", MemWrite);
  785.   #2;   //s1
  786.   if(MemRead !== 0)  $display("j MemRead8- expected: 0 actual: %b", MemRead);
  787.   if(ALUSrcA !== 0) $display("j ALUSrcA8- expected: 0 actual: %b", ALUSrcA);
  788.   if(lorD !== 0)  $display("j lorD8- expected: 0 actual: %b", lorD);
  789.   if(IRWrite !== 0)  $display("j IRWrite8- expected: 0 actual: %b", IRWrite);
  790.   if(ALUSrcB !== 2'b11) $display("j ALUSrcB8- expected: 2'b11 actual: %b", ALUSrcB);
  791.   if(ALUOp !== 2'b00)  $display("j ALUOp8- expected: 2'b00 actual: %b", ALUOp);
  792.   if(PCWrite !== 0)  $display("j PCWrite8- expected: 0 actual: %b", PCWrite);
  793.   if(PCSource !== 2'b00)  $display("j PCSource8- expected: 2'b00 actual: %b", PCSource);
  794.   if(RegDst !== 0) $display("j RegDst8- expected: 0 actual: %b", RegDst);
  795.   if(RegWrite !== 0) $display("j RegWrite8- expected:0 actual: %b", RegWrite);
  796.   if(MemtoReg !== 1) $display("j MemtoReg8- expected: 1 actual: %b", MemtoReg);
  797.   if(MemWrite !== 0) $display("j MemWrite8- expected: 0 actual: %b", MemWrite);
  798.   #2;    //s9
  799.   if(MemRead !== 0)  $display("j MemRead9- expected: 0 actual: %b", MemRead);
  800.   if(ALUSrcA !== 0) $display("j ALUSrcA9- expected: 0 actual: %b", ALUSrcA);
  801.   if(lorD !== 0)  $display("j lorD9- expected: 0 actual: %b", lorD);
  802.   if(IRWrite !== 0)  $display("j IRWrite9- expected: 0 actual: %b", IRWrite);
  803.   if(ALUSrcB !== 2'b11) $display("j ALUSrcB9- expected: 2'b11 actual: %b", ALUSrcB);
  804.   if(ALUOp !== 2'b00)  $display("j ALUOp9- expected: 2'b00 actual: %b", ALUOp);
  805.   if(PCWrite !== 1)  $display("j PCWrite9- expected: 1 actual: %b", PCWrite);
  806.   if(PCSource !== 2'b10)  $display("j PCSource9- expected: 2'b10 actual: %b", PCSource);
  807.   if(RegDst !== 0) $display("j RegDst9- expected: 0 actual: %b", RegDst);
  808.   if(RegWrite !== 0) $display("j RegWrite9- expected:0 actual: %b", RegWrite);
  809.   if(MemtoReg !== 1) $display("j MemtoReg9- expected: 1 actual: %b", MemtoReg);
  810.   if(MemWrite !== 0) $display("j MemWrite9- expected: 0 actual: %b", MemWrite);
  811.   $display("Done J test...");
  812.   #1;
  813. end
  814.  
  815.  
  816. always begin
  817.    #1 Clk = !Clk;
  818. end
  819.  
  820.  
  821.  
  822. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement