Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Starting simulation...
- # Done BEQ test...
- # Starting R-type test...
- # R-type ALUSrcA4
- # R-type ALUOp4- expected: 2'b10 actual: 00
- # R-type RegDst5
- # R-type RegDst6
- # R-type RegDst7
- # R-type ALUSrcA8
- # R-type ALUOp8
- # R-type RegDst9
- # R-type RegDst2'b10
- # R-type RegDst2'b11
- # R-type ALUSrcA12
- # R-type ALUOp12
- # Done R-type test...
- # Starting LW test...
- # lw RegDst1
- # lw RegDst2
- # lw RegDst3
- # lw RegDst4
- # lw lorD5
- # lw MemtoReg6
- # lw MemtoReg7
- # lw MemtoReg8
- # lw MemtoReg9
- # lw lorD10
- # lw MemtoReg11
- # lw MemtoReg12
- # lw MemtoReg13
- # lw MemtoReg14
- # lw lorD15
- # Done LW test...
- # Starting SW test...
- # sw MemtoReg1
- # sw MemtoReg2
- # sw MemtoReg3
- # sw MemtoReg4
- # sw MemtoReg5
- # sw MemtoReg6
- # sw MemtoReg7
- # sw MemtoReg8
- # sw MemtoReg9- expected: 1 actual: 0
- # sw MemtoReg10- expected: 1 actual: 0
- # sw MemtoReg11- expected: 0 actual 0
- # sw MemtoReg12- expected: 1 actual: 0
- # Done SW test...
- # Starting J test...
- # j MemtoReg1- expected: 1 actual: 0
- # j MemtoReg2- expected: 1 actual: 0
- # j ALUSrcB3- expected: 2'b11 actual: 00
- # j MemtoReg3- expected: 1 actual: 0
- module test_controller_2;
- reg [5:0] Op;
- reg Clk;
- wire [1:0] ALUOp, ALUSrcB, PCSource;
- wire PCWriteCond, PCWrite, lorD, MemRead, MemWrite, MemtoReg, IRWrite, ALUSrcA, RegWrite, RegDst;
- controller U0 (
- .Op (Op),
- .Clk (Clk),
- .ALUOp (ALUOp),
- .ALUSrcB (ALUSrcB),
- .PCSource (PCSource),
- .PCWriteCond (PCWriteCond),
- .PCWrite (PCWrite),
- .lorD (lorD),
- .MemRead (MemRead),
- .MemWrite (MemWrite),
- .MemtoReg (MemtoReg),
- .IRWrite (IRWrite) ,
- .ALUSrcA (ALUSrcA),
- .RegWrite (RegWrite),
- .RegDst (RegDst)
- );
- initial begin
- Clk = 0;
- Op = 6'h04;
- $display("Starting simulation...");
- #1; // s0
- if(MemRead !== 1) $display("BEQ MemRead1");
- if(ALUSrcA !== 0) $display("BEQ ALUSrcA1");
- if(lorD !== 0) $display("BEQ lorD1");
- if(IRWrite !== 1) $display("BEQ IRWrite1");
- if(ALUSrcB !== 2'b01) $display("BEQ ALUSrcB1");
- if(ALUOp !== 2'b00) $display("BEQ ALUOp1");
- if(PCWrite !== 1) $display("BEQ PCWrite1");
- if(PCSource !== 2'b00) $display("BEQ PCSource1");
- if(PCWriteCond !== 0) $display("BEQ PCWriteCond1");
- #2; // s1
- if(MemRead !== 0) $display("BEQ MemRead2");
- if(ALUSrcA !== 0) $display("BEQ ALUSrcA2");
- if(lorD !== 0) $display("BEQ lorD2");
- if(IRWrite !== 0) $display("BEQ IRWrite2");
- if(ALUSrcB !== 2'b11) $display("BEQ ALUSrcB2");
- if(ALUOp !== 2'b00) $display("BEQ ALUOp2");
- if(PCWrite !== 0) $display("BEQ PCWrite2");
- if(PCSource !== 2'b00) $display("BEQ PCSource2");
- if(PCWriteCond !== 0) $display("BEQ PCWriteCond2");
- #2; // s8
- if(MemRead !== 0) $display("BEQ MemRead3");
- if(ALUSrcA !== 1) $display("BEQ ALUSrcA3");
- if(lorD !== 0) $display("BEQ lorD3");
- if(IRWrite !== 0) $display("BEQ IRWrite3");
- if(ALUSrcB !== 2'b00) $display("BEQ ALUSrcB3");
- if(ALUOp !== 2'b01) $display("BEQ ALUOp3");
- if(PCWrite !== 0) $display("BEQ PCWrite3");
- if(PCSource !== 2'b01) $display("BEQ PCSource3");
- if(PCWriteCond !== 1) $display("BEQ PCWriteCond3");
- #2; // s0
- if(MemRead !== 1) $display("BEQ MemRead4");
- if(ALUSrcA !== 0) $display("BEQ ALUSrcA4");
- if(lorD !== 0) $display("BEQ lorD4");
- if(IRWrite !== 1) $display("BEQ IRWrite4");
- if(ALUSrcB !== 2'b01) $display("BEQ ALUSrcB4");
- if(ALUOp !== 2'b00) $display("BEQ ALUOp4");
- if(PCWrite !== 1) $display("BEQ PCWrite4");
- if(PCSource !== 2'b00) $display("BEQ PCSource4");
- if(PCWriteCond !== 0) $display("BEQ PCWriteCond4");
- #2; // s1
- if(MemRead !== 0) $display("BEQ MemRead5");
- if(ALUSrcA !== 0) $display("BEQ ALUSrcA5");
- if(lorD !== 0) $display("BEQ lorD5");
- if(IRWrite !== 0) $display("BEQ IRWrite5");
- if(ALUSrcB !== 2'b11) $display("BEQ ALUSrcB5");
- if(ALUOp !== 2'b00) $display("BEQ 5");
- if(PCWrite !== 0) $display("BEQ PCWrite5");
- if(PCSource !== 2'b00) $display("BEQ PCSource5");
- if(PCWriteCond !== 0) $display("BEQ PCWriteCond5");
- #2; // s8
- if(MemRead !== 0) $display("BEQ MemRead6");
- if(ALUSrcA !== 1) $display("BEQ ALUSrcA6");
- if(lorD !== 0) $display("BEQ lorD6");
- if(IRWrite !== 0) $display("BEQ IRWrite6");
- if(ALUSrcB !== 2'b00) $display("BEQ ALUSrcB6");
- if(ALUOp !== 2'b01) $display("BEQ ALUOp6");
- if(PCWrite !== 0) $display("BEQ PCWrite6");
- if(PCSource !== 2'b01) $display("BEQ PCSource6");
- if(PCWriteCond !== 1) $display("BEQ PCWriteCond6");
- #1; // s0
- if(MemRead !== 1) $display("BEQ MemRead7");
- if(ALUSrcA !== 0) $display("BEQ ALUSrcA7");
- if(lorD !== 0) $display("BEQ lorD7");
- if(IRWrite !== 1) $display("BEQ IRWrite7");
- if(ALUSrcB !== 2'b01) $display("BEQ ALUSrcB7");
- if(ALUOp !== 2'b00) $display("BEQ ALUOp7");
- if(PCWrite !== 1) $display("BEQ PCWrite7");
- if(PCSource !== 2'b00) $display("BEQ PCSource7");
- if(PCWriteCond !== 0) $display("BEQ PCWriteCond7");
- #2; // s1
- if(MemRead !== 0) $display("BEQ MemRead8");
- if(ALUSrcA !== 0) $display("BEQ ALUSrcA8");
- if(lorD !== 0) $display("BEQ lorD8");
- if(IRWrite !== 0) $display("BEQ IRWrite8");
- if(ALUSrcB !== 2'b11) $display("BEQ ALUSrcB8");
- if(ALUOp !== 2'b00) $display("BEQ ALUOp8");
- if(PCWrite !== 0) $display("BEQ PCWrite8");
- if(PCSource !== 2'b00) $display("BEQ PCSource8");
- if(PCWriteCond !== 0) $display("BEQ PCWriteCond8");
- #2; // s8
- if(MemRead !== 0) $display("BEQ MemRead9");
- if(ALUSrcA !== 1) $display("BEQ ALUSrcA9");
- if(lorD !== 0) $display("BEQ lorD9");
- if(IRWrite !== 0) $display("BEQ IRWrite9");
- if(ALUSrcB !== 2'b00) $display("BEQ ALUSrcB9");
- if(ALUOp !== 2'b01) $display("BEQ ALUOp9");
- if(PCWrite !== 0) $display("BEQ PCWrite9");
- if(PCSource !== 2'b01) $display("BEQ PCSource9");
- if(PCWriteCond !== 1) $display("BEQ PCWriteCond9");
- $display("Done BEQ test...");
- Op = 6'h00; // r-type
- $display("Starting R-type test...");
- #2; //s0
- if(MemRead !== 1) $display("R-type MemRead1");
- if(ALUSrcA !== 0) $display("R-type ALUSrcA1");
- if(lorD !== 0) $display("R-type lorD1");
- if(IRWrite !== 1) $display("R-type IRWrite1");
- if(ALUSrcB !== 2'b01) $display("R-type ALUSrcB1");
- if(ALUOp !== 2'b00) $display("R-type ALUOp1");
- if(PCWrite !== 1) $display("R-type PCWrite1");
- if(PCSource !== 2'b00) $display("R-type PCSource1");
- if(PCWriteCond !== 0) $display("R-type PCWriteCond1");
- #2; //s1
- if(MemRead !== 0) $display("R-type MemRead2");
- if(ALUSrcA !== 0) $display("R-type ALUSrcA2");
- if(lorD !== 0) $display("R-type lorD2");
- if(IRWrite !== 0) $display("R-type IRWrite2");
- if(ALUSrcB !== 2'b11) $display("R-type ALUSrcB2");
- if(ALUOp !== 2'b00) $display("R-type ALUOp2");
- if(PCWrite !== 0) $display("R-type PCWrite2");
- if(PCSource !== 2'b00) $display("R-type PCSource2");
- if(PCWriteCond !== 0) $display("R-type PCWriteCond2");
- #2; //s6
- if(MemRead !== 0) $display("R-type MemRead3");
- if(ALUSrcA !== 1) $display("R-type ALUSrcA3");
- if(lorD !== 0) $display("R-type lorD3");
- if(IRWrite !== 0) $display("R-type IRWrite3");
- if(ALUSrcB !== 2'b00) $display("R-type ALUSrcB3");
- if(ALUOp !== 2'b10) $display("R-type ALUOp3- expected: 2'b10 actual: %b", ALUOp);
- if(PCWrite !== 0) $display("R-type PCWrite3");
- if(PCSource !== 2'b00) $display("R-type PCSource3");
- if(PCWriteCond !== 0) $display("R-type PCWriteCond3");
- #2; //s7
- if(MemRead !== 0) $display("R-type MemRead4");
- if(ALUSrcA !== 1) $display("R-type ALUSrcA4");
- if(lorD !== 0) $display("R-type lorD4");
- if(IRWrite !== 0) $display("R-type IRWrite4");
- if(ALUSrcB !== 2'b00) $display("R-type ALUSrcB4");
- if(ALUOp !== 2'b10) $display("R-type ALUOp4- expected: 2'b10 actual: %b", ALUOp);
- if(PCWrite !== 0) $display("R-type PCWrite4");
- if(PCSource !== 2'b00) $display("R-type PCSource4");
- if(RegDst !== 1) $display("R-type RegDst4");
- if(RegWrite !== 1) $display("R-type RegWrite4");
- if(MemtoReg !== 0) $display("R-type MemtoReg4");
- if(PCWriteCond !== 0) $display("R-type PCWriteCond4");
- #2; //s0
- if(MemRead !== 1) $display("R-type MemRead5");
- if(ALUSrcA !== 0) $display("R-type ALUSrcA5");
- if(lorD !== 0) $display("R-type lorD5");
- if(IRWrite !== 1) $display("R-type IRWrite5");
- if(ALUSrcB !== 2'b01) $display("R-type ALUSrcB5");
- if(ALUOp !== 2'b00) $display("R-type ALUOp5");
- if(PCWrite !== 1) $display("R-type PCWrite5");
- if(PCSource !== 2'b00) $display("R-type PCSource5");
- if(RegDst !== 1) $display("R-type RegDst5");
- if(RegWrite !== 0) $display("R-type RegWrite5");
- if(MemtoReg !== 0) $display("R-type MemtoReg5");
- if(PCWriteCond !== 0) $display("R-type PCWriteCond5");
- #2; //s1
- if(MemRead !== 0) $display("R-type MemRead6");
- if(ALUSrcA !== 0) $display("R-type ALUSrcA6");
- if(lorD !== 0) $display("R-type lorD6");
- if(IRWrite !== 0) $display("R-type IRWrite6");
- if(ALUSrcB !== 2'b11) $display("R-type ALUSrcB6");
- if(ALUOp !== 2'b00) $display("R-type ALUOp6");
- if(PCWrite !== 0) $display("R-type PCWrite6");
- if(PCSource !== 2'b00) $display("R-type PCSource6");
- if(RegDst !== 1) $display("R-type RegDst6");
- if(RegWrite !== 0) $display("R-type RegWrite6");
- if(MemtoReg !== 0) $display("R-type MemtoReg6");
- if(PCWriteCond !== 0) $display("R-type PCWriteCond6");
- #2; //s6
- if(MemRead !== 0) $display("R-type MemRead7");
- if(ALUSrcA !== 1) $display("R-type ALUSrcA7");
- if(lorD !== 0) $display("R-type lorD7");
- if(IRWrite !== 0) $display("R-type IRWrite7");
- if(ALUSrcB !== 2'b00) $display("R-type ALUSrcB7");
- if(ALUOp !== 2'b10) $display("R-type ALUOp7");
- if(PCWrite !== 0) $display("R-type PCWrite7");
- if(PCSource !== 2'b00) $display("R-type PCSource7");
- if(RegDst !== 1) $display("R-type RegDst7");
- if(RegWrite !== 0) $display("R-type RegWrite7");
- if(MemtoReg !== 0) $display("R-type MemtoReg7");
- if(PCWriteCond !== 0) $display("R-type PCWriteCond7");
- #2; //s7
- if(MemRead !== 0) $display("R-type MemRead8");
- if(ALUSrcA !== 1) $display("R-type ALUSrcA8");
- if(lorD !== 0) $display("R-type lorD8");
- if(IRWrite !== 0) $display("R-type IRWrite8");
- if(ALUSrcB !== 2'b00) $display("R-type ALUSrcB8");
- if(ALUOp !== 2'b10) $display("R-type ALUOp8");
- if(PCWrite !== 0) $display("R-type PCWrite8");
- if(PCSource !== 2'b00) $display("R-type PCSource8");
- if(RegDst !== 1) $display("R-type RegDst8");
- if(RegWrite !== 1) $display("R-type RegWrite8");
- if(MemtoReg !== 0) $display("R-type MemtoReg8");
- if(PCWriteCond !== 0) $display("R-type PCWriteCond8");
- #2; //s0
- if(MemRead !== 1) $display("R-type MemRead9");
- if(ALUSrcA !== 0) $display("R-type ALUSrcA9");
- if(lorD !== 0) $display("R-type lorD9");
- if(IRWrite !== 1) $display("R-type IRWrite9");
- if(ALUSrcB !== 2'b01) $display("R-type ALUSrcB9");
- if(ALUOp !== 2'b00) $display("R-type ALUOp9");
- if(PCWrite !== 1) $display("R-type PCWrite9");
- if(PCSource !== 2'b00) $display("R-type PCSource9");
- if(RegDst !== 1) $display("R-type RegDst9");
- if(RegWrite !== 0) $display("R-type RegWrite9");
- if(MemtoReg !== 0) $display("R-type MemtoReg9");
- if(PCWriteCond !== 0) $display("R-type PCWriteCond9");
- #2; //s1
- if(MemRead !== 0) $display("R-type MemRead2'b10");
- if(ALUSrcA !== 0) $display("R-type ALUSrcA2'b10");
- if(lorD !== 0) $display("R-type lorD2'b10");
- if(IRWrite !== 0) $display("R-type IRWrite2'b10");
- if(ALUSrcB !== 2'b11) $display("R-type ALUSrcB2'b10");
- if(ALUOp !== 2'b00) $display("R-type ALUOp2'b10");
- if(PCWrite !== 0) $display("R-type PCWrite2'b10");
- if(PCSource !== 2'b00) $display("R-type PCSource2'b10");
- if(RegDst !== 1) $display("R-type RegDst2'b10");
- if(RegWrite !== 0) $display("R-type RegWrite2'b10");
- if(MemtoReg !== 0) $display("R-type MemtoReg2'b10");
- if(PCWriteCond !== 0) $display("R-type PCWriteCond2'b10");
- #2; //s6
- if(MemRead !== 0) $display("R-type MemRead2'b11");
- if(ALUSrcA !== 1) $display("R-type ALUSrcA2'b11");
- if(lorD !== 0) $display("R-type lorD2'b11");
- if(IRWrite !== 0) $display("R-type IRWrite2'b11");
- if(ALUSrcB !== 2'b00) $display("R-type ALUSrcB2'b11");
- if(ALUOp !== 2'b10) $display("R-type ALUOp2'b11");
- if(PCWrite !== 0) $display("R-type PCWrite2'b11");
- if(PCSource !== 2'b00) $display("R-type PCSource2'b11");
- if(RegDst !== 1) $display("R-type RegDst2'b11");
- if(RegWrite !== 0) $display("R-type RegWrite2'b11");
- if(MemtoReg !== 0) $display("R-type MemtoReg2'b11");
- if(PCWriteCond !== 0) $display("R-type PCWriteCond2'b11");
- #2; //s7
- if(MemRead !== 0) $display("R-type MemRead12");
- if(ALUSrcA !== 1) $display("R-type ALUSrcA12");
- if(lorD !== 0) $display("R-type lorD12");
- if(IRWrite !== 0) $display("R-type IRWrite12");
- if(ALUSrcB !== 2'b00) $display("R-type ALUSrcB12");
- if(ALUOp !== 2'b10) $display("R-type ALUOp12");
- if(PCWrite !== 0) $display("R-type PCWrite12");
- if(PCSource !== 2'b00) $display("R-type PCSource12");
- if(RegDst !== 1) $display("R-type RegDst12");
- if(RegWrite !== 1) $display("R-type RegWrite12");
- if(MemtoReg !== 0) $display("R-type MemtoReg12");
- if(PCWriteCond !== 0) $display("R-type PCWriteCond12");
- $display("Done R-type test...");
- #1;
- Op = 6'h23; // lw
- $display("Starting LW test...");
- #1; //s0
- if(MemRead !== 1) $display("lw MemRead1");
- if(ALUSrcA !== 0) $display("lw ALUSrcA1");
- if(lorD !== 0) $display("lw lorD1");
- if(IRWrite !== 1) $display("lw IRWrite1");
- if(ALUSrcB !== 2'b01) $display("lw ALUSrcB1");
- if(ALUOp !== 2'b00) $display("lw ALUOp1");
- if(PCWrite !== 1) $display("lw PCWrite1");
- if(PCSource !== 2'b00) $display("lw PCSource1");
- if(RegDst !== 1) $display("lw RegDst1");
- if(RegWrite !== 0) $display("lw RegWrite1");
- if(MemtoReg !== 0) $display("lw MemtoReg1");
- if(PCWriteCond !== 0) $display("lw PCWriteCond1");
- #2; //s1
- if(MemRead !== 0) $display("lw MemRead2");
- if(ALUSrcA !== 0) $display("lw ALUSrcA2");
- if(lorD !== 0) $display("lw lorD2");
- if(IRWrite !== 0) $display("lw IRWrite2");
- if(ALUSrcB !== 2'b11) $display("lw ALUSrcB2");
- if(ALUOp !== 2'b00) $display("lw ALUOp2");
- if(PCWrite !== 0) $display("lw PCWrite2");
- if(PCSource !== 2'b00) $display("lw PCSource2");
- if(RegDst !== 1) $display("lw RegDst2");
- if(RegWrite !== 0) $display("lw RegWrite2");
- if(MemtoReg !== 0) $display("lw MemtoReg2");
- if(PCWriteCond !== 0) $display("lw PCWriteCond2");
- #2; //s2
- if(MemRead !== 0) $display("lw MemRead3");
- if(ALUSrcA !== 1) $display("lw ALUSrcA3");
- if(lorD !== 0) $display("lw lorD3");
- if(IRWrite !== 0) $display("lw IRWrite3");
- if(ALUSrcB !== 2'b10) $display("lw ALUSrcB3");
- if(ALUOp !== 2'b00) $display("lw ALUOp3");
- if(PCWrite !== 0) $display("lw PCWrite3");
- if(PCSource !== 2'b00) $display("lw PCSource3");
- if(RegDst !== 1) $display("lw RegDst3");
- if(RegWrite !== 0) $display("lw RegWrite3");
- if(MemtoReg !== 0) $display("lw MemtoReg3");
- if(PCWriteCond !== 0) $display("lw PCWriteCond3");
- #2; //s3
- if(MemRead !== 1) $display("lw MemRead4");
- if(ALUSrcA !== 1) $display("lw ALUSrcA4");
- if(lorD !== 1) $display("lw lorD4");
- if(IRWrite !== 0) $display("lw IRWrite4");
- if(ALUSrcB !== 2'b10) $display("lw ALUSrcB4");
- if(ALUOp !== 2'b00) $display("lw ALUOp4");
- if(PCWrite !== 0) $display("lw PCWrite4");
- if(PCSource !== 2'b00) $display("lw PCSource4");
- if(RegDst !== 1) $display("lw RegDst4");
- if(RegWrite !== 0) $display("lw RegWrite4");
- if(MemtoReg !== 0) $display("lw MemtoReg4");
- if(PCWriteCond !== 0) $display("lw PCWriteCond4");
- #2; //s4
- if(MemRead !== 0) $display("lw MemRead5"); // TODO: remove test
- if(ALUSrcA !== 1) $display("lw ALUSrcA5");
- if(lorD !== 1) $display("lw lorD5");
- if(IRWrite !== 0) $display("lw IRWrite5");
- if(ALUSrcB !== 2'b10) $display("lw ALUSrcB5");
- if(ALUOp !== 2'b00) $display("lw ALUOp5");
- if(PCWrite !== 0) $display("lw PCWrite5");
- if(PCSource !== 2'b00) $display("lw PCSource5");
- if(RegDst !== 0) $display("lw RegDst5");
- if(RegWrite !== 1) $display("lw RegWrite5");
- if(MemtoReg !== 1) $display("lw MemtoReg5"); // TODO: turn on memread
- if(PCWriteCond !== 0) $display("lw PCWriteCond5");
- #2; //s0
- if(MemRead !== 1) $display("lw MemRead6");
- if(ALUSrcA !== 0) $display("lw ALUSrcA6");
- if(lorD !== 0) $display("lw lorD6");
- if(IRWrite !== 1) $display("lw IRWrite6");
- if(ALUSrcB !== 2'b01) $display("lw ALUSrcB6");
- if(ALUOp !== 2'b00) $display("lw ALUOp6");
- if(PCWrite !== 1) $display("lw PCWrite6");
- if(PCSource !== 2'b00) $display("lw PCSource6");
- if(RegDst !== 0) $display("lw RegDst6");
- if(RegWrite !== 0) $display("lw RegWrite6");
- if(MemtoReg !== 1) $display("lw MemtoReg6");
- if(PCWriteCond !== 0) $display("lw PCWriteCond6");
- #2; //s1
- if(MemRead !== 0) $display("lw MemRead7");
- if(ALUSrcA !== 0) $display("lw ALUSrcA7");
- if(lorD !== 0) $display("lw lorD7");
- if(IRWrite !== 0) $display("lw IRWrite7");
- if(ALUSrcB !== 2'b11) $display("lw ALUSrcB7");
- if(ALUOp !== 2'b00) $display("lw ALUOp7");
- if(PCWrite !== 0) $display("lw PCWrite7");
- if(PCSource !== 2'b00) $display("lw PCSource7");
- if(RegDst !== 0) $display("lw RegDst7");
- if(RegWrite !== 0) $display("lw RegWrite7");
- if(MemtoReg !== 1) $display("lw MemtoReg7");
- if(PCWriteCond !== 0) $display("lw PCWriteCond7");
- #2; //s2
- if(MemRead !== 0) $display("lw MemRead8");
- if(ALUSrcA !== 1) $display("lw ALUSrcA8");
- if(lorD !== 0) $display("lw lorD8");
- if(IRWrite !== 0) $display("lw IRWrite8");
- if(ALUSrcB !== 2'b10) $display("lw ALUSrcB8");
- if(ALUOp !== 2'b00) $display("lw ALUOp8");
- if(PCWrite !== 0) $display("lw PCWrite8");
- if(PCSource !== 2'b00) $display("lw PCSource8");
- if(RegDst !== 0) $display("lw RegDst8");
- if(RegWrite !== 0) $display("lw RegWrite8");
- if(MemtoReg !== 1) $display("lw MemtoReg8");
- if(PCWriteCond !== 0) $display("lw PCWriteCond8");
- #2; //s3
- if(MemRead !== 1) $display("lw MemRead9");
- if(ALUSrcA !== 1) $display("lw ALUSrcA9");
- if(lorD !== 1) $display("lw lorD9");
- if(IRWrite !== 0) $display("lw IRWrite9");
- if(ALUSrcB !== 2'b10) $display("lw ALUSrcB9");
- if(ALUOp !== 2'b00) $display("lw ALUOp9");
- if(PCWrite !== 0) $display("lw PCWrite9");
- if(PCSource !== 2'b00) $display("lw PCSource9");
- if(RegDst !== 0) $display("lw RegDst9");
- if(RegWrite !== 0) $display("lw RegWrite9");
- if(MemtoReg !== 1) $display("lw MemtoReg9");
- if(PCWriteCond !== 0) $display("lw PCWriteCond9");
- #2; //s4
- if(MemRead !== 0) $display("lw MemRead10"); // TODO: remove test
- if(ALUSrcA !== 1) $display("lw ALUSrcA10");
- if(lorD !== 1) $display("lw lorD10");
- if(IRWrite !== 0) $display("lw IRWrite10");
- if(ALUSrcB !== 2'b10) $display("lw ALUSrcB10");
- if(ALUOp !== 2'b00) $display("lw ALUOp10");
- if(PCWrite !== 0) $display("lw PCWrite10");
- if(PCSource !== 2'b00) $display("lw PCSource10");
- if(RegDst !== 0) $display("lw RegDst10");
- if(RegWrite !== 1) $display("lw RegWrite10");
- if(MemtoReg !== 1) $display("lw MemtoReg10"); // TODO: turn on memread
- if(PCWriteCond !== 0) $display("lw PCWriteCond10");
- #2; //s0
- if(MemRead !== 1) $display("lw MemRead11");
- if(ALUSrcA !== 0) $display("lw ALUSrcA11");
- if(lorD !== 0) $display("lw lorD11");
- if(IRWrite !== 1) $display("lw IRWrite11");
- if(ALUSrcB !== 2'b01) $display("lw ALUSrcB11");
- if(ALUOp !== 2'b00) $display("lw ALUOp11");
- if(PCWrite !== 1) $display("lw PCWrite11");
- if(PCSource !== 2'b00) $display("lw PCSource11");
- if(RegDst !== 0) $display("lw RegDst11");
- if(RegWrite !== 0) $display("lw RegWrite11");
- if(MemtoReg !== 1) $display("lw MemtoReg11");
- if(PCWriteCond !== 0) $display("lw PCWriteCond11");
- #2; //s1
- if(MemRead !== 0) $display("lw MemRead12");
- if(ALUSrcA !== 0) $display("lw ALUSrcA12");
- if(lorD !== 0) $display("lw lorD12");
- if(IRWrite !== 0) $display("lw IRWrite12");
- if(ALUSrcB !== 2'b11) $display("lw ALUSrcB12");
- if(ALUOp !== 2'b00) $display("lw ALUOp12");
- if(PCWrite !== 0) $display("lw PCWrite12");
- if(PCSource !== 2'b00) $display("lw PCSource12");
- if(RegDst !== 0) $display("lw RegDst12");
- if(RegWrite !== 0) $display("lw RegWrite12");
- if(MemtoReg !== 1) $display("lw MemtoReg12");
- if(PCWriteCond !== 0) $display("lw PCWriteCond12");
- #2; //s2
- if(MemRead !== 0) $display("lw MemRead13");
- if(ALUSrcA !== 1) $display("lw ALUSrcA13");
- if(lorD !== 0) $display("lw lorD13");
- if(IRWrite !== 0) $display("lw IRWrite13");
- if(ALUSrcB !== 2'b10) $display("lw ALUSrcB13");
- if(ALUOp !== 2'b00) $display("lw ALUOp13");
- if(PCWrite !== 0) $display("lw PCWrite13");
- if(PCSource !== 2'b00) $display("lw PCSource13");
- if(RegDst !== 0) $display("lw RegDst13");
- if(RegWrite !== 0) $display("lw RegWrite13");
- if(MemtoReg !== 1) $display("lw MemtoReg13");
- if(PCWriteCond !== 0) $display("lw PCWriteCond13");
- #2; //s3
- if(MemRead !== 1) $display("lw MemRead14");
- if(ALUSrcA !== 1) $display("lw ALUSrcA14");
- if(lorD !== 1) $display("lw lorD14");
- if(IRWrite !== 0) $display("lw IRWrite14");
- if(ALUSrcB !== 2'b10) $display("lw ALUSrcB14");
- if(ALUOp !== 2'b00) $display("lw ALUOp14");
- if(PCWrite !== 0) $display("lw PCWrite14");
- if(PCSource !== 2'b00) $display("lw PCSource14");
- if(RegDst !== 0) $display("lw RegDst14");
- if(RegWrite !== 0) $display("lw RegWrite14");
- if(MemtoReg !== 1) $display("lw MemtoReg14");
- if(PCWriteCond !== 0) $display("lw PCWriteCond14");
- #2; //s4
- if(MemRead !== 0) $display("lw MemRead15");
- if(ALUSrcA !== 1) $display("lw ALUSrcA15");
- if(lorD !== 1) $display("lw lorD15");
- if(IRWrite !== 0) $display("lw IRWrite15");
- if(ALUSrcB !== 2'b10) $display("lw ALUSrcB15");
- if(ALUOp !== 2'b00) $display("lw ALUOp15");
- if(PCWrite !== 0) $display("lw PCWrite15");
- if(PCSource !== 2'b00) $display("lw PCSource15");
- if(RegDst !== 0) $display("lw RegDst15");
- if(RegWrite !== 1) $display("lw RegWrite15");
- if(MemtoReg !== 1) $display("lw MemtoReg15"); // TODO: turn on memread
- if(PCWriteCond !== 0) $display("lw PCWriteCond15");
- $display("Done LW test...");
- #1;
- //TODO: up to here should be updated with flags
- Op = 6'h2b; // sw
- $display("Starting SW test...");
- #1; //s0
- if(MemRead !== 1) $display("sw MemRead1");
- if(ALUSrcA !== 0) $display("sw ALUSrcA1");
- if(lorD !== 0) $display("sw lorD1");
- if(IRWrite !== 1) $display("sw IRWrite1");
- if(ALUSrcB !== 2'b01) $display("sw ALUSrcB1");
- if(ALUOp !== 2'b00) $display("sw ALUOp1");
- if(PCWrite !== 1) $display("sw PCWrite1");
- if(PCSource !== 2'b00) $display("sw PCSource1");
- if(RegDst !== 0) $display("sw RegDst1");
- if(RegWrite !== 0) $display("sw RegWrite1");
- if(MemtoReg !== 1) $display("sw MemtoReg1");
- #2; //s1
- if(MemRead !== 0) $display("sw MemRead2");
- if(ALUSrcA !== 0) $display("sw ALUSrcA2");
- if(lorD !== 0) $display("sw lorD2");
- if(IRWrite !== 0) $display("sw IRWrite2");
- if(ALUSrcB !== 2'b11) $display("sw ALUSrcB2");
- if(ALUOp !== 2'b00) $display("sw ALUOp2");
- if(PCWrite !== 0) $display("sw PCWrite2");
- if(PCSource !== 2'b00) $display("sw PCSource2");
- if(RegDst !== 0) $display("sw RegDst2");
- if(RegWrite !== 0) $display("sw RegWrite2");
- if(MemtoReg !== 1) $display("sw MemtoReg2");
- #2; //s2
- if(MemRead !== 0) $display("sw MemRead3");
- if(ALUSrcA !== 1) $display("sw ALUSrcA3");
- if(lorD !== 0) $display("sw lorD3");
- if(IRWrite !== 0) $display("sw IRWrite3");
- if(ALUSrcB !== 2'b10) $display("sw ALUSrcB3");
- if(ALUOp !== 2'b00) $display("sw ALUOp3");
- if(PCWrite !== 0) $display("sw PCWrite3");
- if(PCSource !== 2'b00) $display("sw PCSource3");
- if(RegDst !== 0) $display("sw RegDst3");
- if(RegWrite !== 0) $display("sw RegWrite3");
- if(MemtoReg !== 1) $display("sw MemtoReg3");
- #2; //s5
- if(MemRead !== 0) $display("sw MemRead4");
- if(ALUSrcA !== 1) $display("sw ALUSrcA4");
- if(lorD !== 1) $display("sw lorD4");
- if(IRWrite !== 0) $display("sw IRWrite4");
- if(ALUSrcB !== 2'b10) $display("sw ALUSrcB4");
- if(ALUOp !== 2'b00) $display("sw ALUOp4");
- if(PCWrite !== 0) $display("sw PCWrite4");
- if(PCSource !== 2'b00) $display("sw PCSource4");
- if(RegDst !== 0) $display("sw RegDst4");
- if(RegWrite !== 0) $display("sw RegWrite4");
- if(MemtoReg !== 1) $display("sw MemtoReg4");
- if(MemWrite !== 1) $display("sw MemWrite4");
- #2; //s0
- if(MemRead !== 1) $display("sw MemRead5");
- if(ALUSrcA !== 0) $display("sw ALUSrcA5");
- if(lorD !== 0) $display("sw lorD5");
- if(IRWrite !== 1) $display("sw IRWrite5");
- if(ALUSrcB !== 2'b01) $display("sw ALUSrcB5");
- if(ALUOp !== 2'b00) $display("sw ALUOp5");
- if(PCWrite !== 1) $display("sw PCWrite5");
- if(PCSource !== 2'b00) $display("sw PCSource5");
- if(RegDst !== 0) $display("sw RegDst5");
- if(RegWrite !== 0) $display("sw RegWrite5");
- if(MemtoReg !== 1) $display("sw MemtoReg5");
- if(MemWrite !== 0) $display("sw MemWrite5");
- #2; //s1
- if(MemRead !== 0) $display("sw MemRead6");
- if(ALUSrcA !== 0) $display("sw ALUSrcA6");
- if(lorD !== 0) $display("sw lorD6");
- if(IRWrite !== 0) $display("sw IRWrite6");
- if(ALUSrcB !== 2'b11) $display("sw ALUSrcB6");
- if(ALUOp !== 2'b00) $display("sw ALUOp6");
- if(PCWrite !== 0) $display("sw PCWrite6");
- if(PCSource !== 2'b00) $display("sw PCSource6");
- if(RegDst !== 0) $display("sw RegDst6");
- if(RegWrite !== 0) $display("sw RegWrite6");
- if(MemtoReg !== 1) $display("sw MemtoReg6");
- if(MemWrite !== 0) $display("sw MemWrite6");
- #2; //s2
- if(MemRead !== 0) $display("sw MemRead7");
- if(ALUSrcA !== 1) $display("sw ALUSrcA7");
- if(lorD !== 0) $display("sw lorD7");
- if(IRWrite !== 0) $display("sw IRWrite7");
- if(ALUSrcB !== 2'b10) $display("sw ALUSrcB7");
- if(ALUOp !== 2'b00) $display("sw ALUOp7");
- if(PCWrite !== 0) $display("sw PCWrite7");
- if(PCSource !== 2'b00) $display("sw PCSource7");
- if(RegDst !== 0) $display("sw RegDst7");
- if(RegWrite !== 0) $display("sw RegWrite7");
- if(MemtoReg !== 1) $display("sw MemtoReg7");
- if(MemWrite !== 0) $display("sw MemWrite7");
- #2; //s5
- if(MemRead !== 0) $display("sw MemRead8");
- if(ALUSrcA !== 1) $display("sw ALUSrcA8");
- if(lorD !== 1) $display("sw lorD8");
- if(IRWrite !== 0) $display("sw IRWrite8");
- if(ALUSrcB !== 2'b10) $display("sw ALUSrcB8");
- if(ALUOp !== 2'b00) $display("sw ALUOp8");
- if(PCWrite !== 0) $display("sw PCWrite8");
- if(PCSource !== 2'b00) $display("sw PCSource8");
- if(RegDst !== 0) $display("sw RegDst8");
- if(RegWrite !== 0) $display("sw RegWrite8");
- if(MemtoReg !== 1) $display("sw MemtoReg8");
- if(MemWrite !== 1) $display("sw MemWrite5");
- #2; //s0
- if(MemRead !== 1) $display("sw MemRead9- expected: 1 actual: %b", MemRead);
- if(ALUSrcA !== 0) $display("sw ALUSrcA9- expected: 0 actual: %b", ALUSrcA);
- if(lorD !== 0) $display("sw lorD9- expected: 0 actual: %b", lorD);
- if(IRWrite !== 1) $display("sw IRWrite9- expected: 1 actual: %b", IRWrite);
- if(ALUSrcB !== 2'b01) $display("sw ALUSrcB9- expected: 2'b01 actual: %b", ALUSrcB);
- if(ALUOp !== 2'b00) $display("sw ALUOp9- expected: 2'b00 actual: %b", ALUOp);
- if(PCWrite !== 1) $display("sw PCWrite9- expected: 1 actual: %b", PCWrite);
- if(PCSource !== 2'b00) $display("sw PCSource9- expected: 2'b00 actual: %b", PCSource);
- if(RegDst !== 0) $display("sw RegDst9- expected: 0 actual: %b", RegDst);
- if(RegWrite !== 0) $display("sw RegWrite9- expected: 0 actual: %b", RegWrite);
- if(MemtoReg !== 1) $display("sw MemtoReg9- expected: 1 actual: %b", MemtoReg);
- if(MemWrite !== 0) $display("sw MemWrite9- expected: 0 actual: %b", MemWrite);
- #2; //s1
- if(MemRead !== 0) $display("sw MemRead10- expected: 0 actual: %b", MemRead);
- if(ALUSrcA !== 0) $display("sw ALUSrcA10- expected: 0 actual: %b", ALUSrcA);
- if(lorD !== 0) $display("sw lorD10- expected: 0 actual: %b", lorD);
- if(IRWrite !== 0) $display("sw IRWrite10- expected: 0 actual: %b", IRWrite);
- if(ALUSrcB !== 2'b11) $display("sw ALUSrcB10- expected: 2'b11 actual: %b", ALUSrcB);
- if(ALUOp !== 2'b00) $display("sw ALUOp10- expected: 2'b00 actual: %b", ALUOp);
- if(PCWrite !== 0) $display("sw PCWrite10- expected: 0 actual: %b", PCWrite);
- if(PCSource !== 2'b00) $display("sw PCSource10- expected: 2'b00 actual: %b", PCSource);
- if(RegDst !== 0) $display("sw RegDst10- expected: 0 actual: %b", RegDst);
- if(RegWrite !== 0) $display("sw RegWrite10- expected:0 actual: %b", RegWrite);
- if(MemtoReg !== 1) $display("sw MemtoReg10- expected: 1 actual: %b", MemtoReg);
- if(MemWrite !== 0) $display("sw MemWrite10- expected: 0 actual: %b", MemWrite);
- #2; //s2
- if(MemRead !== 0) $display("sw MemRead11- expected: 0 actual: %b", MemRead);
- if(ALUSrcA !== 1) $display("sw ALUSrcA11- expected: 1 actual: %b", ALUSrcA);
- if(lorD !== 0) $display("sw lorD11- expected: 0 actual: %b", lorD);
- if(IRWrite !== 0) $display("sw IRWrite11- expected: 0 actual: %b", IRWrite);
- if(ALUSrcB !== 2'b10) $display("sw ALUSrcB11- expected:: 2'b10 actual: %b", ALUSrcB);
- if(ALUOp !== 2'b00) $display("sw ALUOp11- expected: 2'b00 actual: %b", ALUOp);
- if(PCWrite !== 0) $display("sw PCWrite11- expected: 0 actual: %b", PCWrite);
- if(PCSource !== 2'b00) $display("sw PCSource11- expected: 2'b00 actual: %b", PCSource);
- if(RegDst !== 0) $display("sw RegDst2'b11- expected: 0 actual: %b", RegDst);
- if(RegWrite !== 0) $display("sw RegWrite11- expected: 0 actual: %b",RegWrite);
- if(MemtoReg !== 1) $display("sw MemtoReg11- expected: 0 actual %b", MemtoReg);
- if(MemWrite !== 0) $display("sw MemWrite11- expected: 0 actual: %b", MemWrite);
- #2; //s5
- if(MemRead !== 0) $display("sw MemRead12- expected: 0 actual: %b", MemRead);
- if(ALUSrcA !== 1) $display("sw ALUSrcA12- expected: 1 actual: %b", ALUSrcA);
- if(lorD !== 1) $display("sw lorD12- expected: 1 actual: %b", lorD);
- if(IRWrite !== 0) $display("sw IRWrite12- expected: 0 actual: %b", IRWrite);
- if(ALUSrcB !== 2'b10) $display("sw ALUSrcB12- expected 2'b10 actual: %b",ALUSrcB);
- if(ALUOp !== 2'b00) $display("sw ALUOp12- expected: 2'b00 actual: %b",ALUOp);
- if(PCWrite !== 0) $display("sw PCWrite12- expected: 0 actual: %b", PCWrite);
- if(PCSource !== 2'b00) $display("sw PCSource12- expected: 2'b00 actual: %b", PCSource);
- if(RegDst !== 0) $display("sw RegDst12- expected: 0 actual: %b", RegDst);
- if(RegWrite !== 0) $display("sw RegWrite12- expected: 0 actual: %b", RegWrite);
- if(MemtoReg !== 1) $display("sw MemtoReg12- expected: 1 actual: %b", MemtoReg);
- if(MemWrite !== 1) $display("sw MemWrite12- expected: 1 actual: $b", MemWrite);
- $display("Done SW test...");
- #1;
- Op = 6'h02; // j
- $display("Starting J test...");
- #1; //s0
- if(MemRead !== 1) $display("j MemRead1- expected: 1 actual: %b", MemRead);
- if(ALUSrcA !== 0) $display("j ALUSrcA1- expected: 0 actual: %b", ALUSrcA);
- if(lorD !== 0) $display("j lorD1- expected: 0 actual: %b", lorD);
- if(IRWrite !== 1) $display("j IRWrite1- expected: 1 actual: %b", IRWrite);
- if(ALUSrcB !== 2'b01) $display("j ALUSrcB1- expected: 2'b01 actual: %b", ALUSrcB);
- if(ALUOp !== 2'b00) $display("j ALUOp1- expected: 2'b00 actual: %b", ALUOp);
- if(PCWrite !== 1) $display("j PCWrite1- expected: 1 actual: %b", PCWrite);
- if(PCSource !== 2'b00) $display("j PCSource1- expected: 2'b00 actual: %b", PCSource);
- if(RegDst !== 0) $display("j RegDst1- expected: 0 actual: %b", RegDst);
- if(RegWrite !== 0) $display("j RegWrite1- expected: 0 actual: %b", RegWrite);
- if(MemtoReg !== 1) $display("j MemtoReg1- expected: 1 actual: %b", MemtoReg);
- if(MemWrite !== 0) $display("j MemWrite1- expected: 0 actual: %b", MemWrite);
- #2; //s1
- if(MemRead !== 0) $display("j MemRead2- expected: 0 actual: %b", MemRead);
- if(ALUSrcA !== 0) $display("j ALUSrcA2- expected: 0 actual: %b", ALUSrcA);
- if(lorD !== 0) $display("j lorD2- expected: 0 actual: %b", lorD);
- if(IRWrite !== 0) $display("j IRWrite2- expected: 0 actual: %b", IRWrite);
- if(ALUSrcB !== 2'b11) $display("j ALUSrcB2- expected: 2'b11 actual: %b", ALUSrcB);
- if(ALUOp !== 2'b00) $display("j ALUOp2- expected: 2'b00 actual: %b", ALUOp);
- if(PCWrite !== 0) $display("j PCWrite2- expected: 0 actual: %b", PCWrite);
- if(PCSource !== 2'b00) $display("j PCSource2- expected: 2'b00 actual: %b", PCSource);
- if(RegDst !== 0) $display("j RegDst2- expected: 0 actual: %b", RegDst);
- if(RegWrite !== 0) $display("j RegWrite2- expected:0 actual: %b", RegWrite);
- if(MemtoReg !== 1) $display("j MemtoReg2- expected: 1 actual: %b", MemtoReg);
- if(MemWrite !== 0) $display("j MemWrite2- expected: 0 actual: %b", MemWrite);
- #2; //s9
- if(MemRead !== 0) $display("j MemRead3- expected: 0 actual: %b", MemRead);
- if(ALUSrcA !== 0) $display("j ALUSrcA3- expected: 0 actual: %b", ALUSrcA);
- if(lorD !== 0) $display("j lorD3- expected: 0 actual: %b", lorD);
- if(IRWrite !== 0) $display("j IRWrite3- expected: 0 actual: %b", IRWrite);
- if(ALUSrcB !== 2'b11) $display("j ALUSrcB3- expected: 2'b11 actual: %b", ALUSrcB);
- if(ALUOp !== 2'b00) $display("j ALUOp3- expected: 2'b00 actual: %b", ALUOp);
- if(PCWrite !== 1) $display("j PCWrite3- expected: 1 actual: %b", PCWrite);
- if(PCSource !== 2'b10) $display("j PCSource3- expected: 2'b10 actual: %b", PCSource);
- if(RegDst !== 0) $display("j RegDst3- expected: 0 actual: %b", RegDst);
- if(RegWrite !== 0) $display("j RegWrite3- expected:0 actual: %b", RegWrite);
- if(MemtoReg !== 1) $display("j MemtoReg3- expected: 1 actual: %b", MemtoReg);
- if(MemWrite !== 0) $display("j MemWrite3- expected: 0 actual: %b", MemWrite);
- #2; //s0
- if(MemRead !== 1) $display("j MemRead4- expected: 1 actual: %b", MemRead);
- if(ALUSrcA !== 0) $display("j ALUSrcA4- expected: 0 actual: %b", ALUSrcA);
- if(lorD !== 0) $display("j lorD4- expected: 0 actual: %b", lorD);
- if(IRWrite !== 1) $display("j IRWrite4- expected: 1 actual: %b", IRWrite);
- if(ALUSrcB !== 2'b01) $display("j ALUSrcB4- expected: 2'b01 actual: %b", ALUSrcB);
- if(ALUOp !== 2'b00) $display("j ALUOp4- expected: 2'b00 actual: %b", ALUOp);
- if(PCWrite !== 1) $display("j PCWrite4- expected: 1 actual: %b", PCWrite);
- if(PCSource !== 2'b00) $display("j PCSource4- expected: 2'b00 actual: %b", PCSource);
- if(RegDst !== 0) $display("j RegDst4- expected: 0 actual: %b", RegDst);
- if(RegWrite !== 0) $display("j RegWrite4- expected: 0 actual: %b", RegWrite);
- if(MemtoReg !== 1) $display("j MemtoReg4- expected: 1 actual: %b", MemtoReg);
- if(MemWrite !== 0) $display("j MemWrite4- expected: 0 actual: %b", MemWrite);
- #2; //s1
- if(MemRead !== 0) $display("j MemRead5- expected: 0 actual: %b", MemRead);
- if(ALUSrcA !== 0) $display("j ALUSrcA5- expected: 0 actual: %b", ALUSrcA);
- if(lorD !== 0) $display("j lorD5- expected: 0 actual: %b", lorD);
- if(IRWrite !== 0) $display("j IRWrite5- expected: 0 actual: %b", IRWrite);
- if(ALUSrcB !== 2'b11) $display("j ALUSrcB5- expected: 2'b11 actual: %b", ALUSrcB);
- if(ALUOp !== 2'b00) $display("j ALUOp5- expected: 2'b00 actual: %b", ALUOp);
- if(PCWrite !== 0) $display("j PCWrite5- expected: 0 actual: %b", PCWrite);
- if(PCSource !== 2'b00) $display("j PCSource5- expected: 2'b00 actual: %b", PCSource);
- if(RegDst !== 0) $display("j RegDst5- expected: 0 actual: %b", RegDst);
- if(RegWrite !== 0) $display("j RegWrite5- expected:0 actual: %b", RegWrite);
- if(MemtoReg !== 1) $display("j MemtoReg5- expected: 1 actual: %b", MemtoReg);
- if(MemWrite !== 0) $display("j MemWrite5- expected: 0 actual: %b", MemWrite);
- #2; //s9
- if(MemRead !== 0) $display("j MemRead6- expected: 0 actual: %b", MemRead);
- if(ALUSrcA !== 0) $display("j ALUSrcA6- expected: 0 actual: %b", ALUSrcA);
- if(lorD !== 0) $display("j lorD6- expected: 0 actual: %b", lorD);
- if(IRWrite !== 0) $display("j IRWrite6- expected: 0 actual: %b", IRWrite);
- if(ALUSrcB !== 2'b11) $display("j ALUSrcB6- expected: 2'b11 actual: %b", ALUSrcB);
- if(ALUOp !== 2'b00) $display("j ALUOp6- expected: 2'b00 actual: %b", ALUOp);
- if(PCWrite !== 1) $display("j PCWrite6- expected: 1 actual: %b", PCWrite);
- if(PCSource !== 2'b10) $display("j PCSource6- expected: 2'b10 actual: %b", PCSource);
- if(RegDst !== 0) $display("j RegDst6- expected: 0 actual: %b", RegDst);
- if(RegWrite !== 0) $display("j RegWrite6- expected:0 actual: %b", RegWrite);
- if(MemtoReg !== 1) $display("j MemtoReg6- expected: 1 actual: %b", MemtoReg);
- if(MemWrite !== 0) $display("j MemWrite6- expected: 0 actual: %b", MemWrite);
- #2; //s0
- if(MemRead !== 1) $display("j MemRead7- expected: 1 actual: %b", MemRead);
- if(ALUSrcA !== 0) $display("j ALUSrcA7- expected: 0 actual: %b", ALUSrcA);
- if(lorD !== 0) $display("j lorD7- expected: 0 actual: %b", lorD);
- if(IRWrite !== 1) $display("j IRWrite7- expected: 1 actual: %b", IRWrite);
- if(ALUSrcB !== 2'b01) $display("j ALUSrcB7- expected: 2'b01 actual: %b", ALUSrcB);
- if(ALUOp !== 2'b00) $display("j ALUOp7- expected: 2'b00 actual: %b", ALUOp);
- if(PCWrite !== 1) $display("j PCWrite7- expected: 1 actual: %b", PCWrite);
- if(PCSource !== 2'b00) $display("j PCSource7- expected: 2'b00 actual: %b", PCSource);
- if(RegDst !== 0) $display("j RegDst7- expected: 0 actual: %b", RegDst);
- if(RegWrite !== 0) $display("j RegWrite7- expected: 0 actual: %b", RegWrite);
- if(MemtoReg !== 1) $display("j MemtoReg7- expected: 1 actual: %b", MemtoReg);
- if(MemWrite !== 0) $display("j MemWrite7- expected: 0 actual: %b", MemWrite);
- #2; //s1
- if(MemRead !== 0) $display("j MemRead8- expected: 0 actual: %b", MemRead);
- if(ALUSrcA !== 0) $display("j ALUSrcA8- expected: 0 actual: %b", ALUSrcA);
- if(lorD !== 0) $display("j lorD8- expected: 0 actual: %b", lorD);
- if(IRWrite !== 0) $display("j IRWrite8- expected: 0 actual: %b", IRWrite);
- if(ALUSrcB !== 2'b11) $display("j ALUSrcB8- expected: 2'b11 actual: %b", ALUSrcB);
- if(ALUOp !== 2'b00) $display("j ALUOp8- expected: 2'b00 actual: %b", ALUOp);
- if(PCWrite !== 0) $display("j PCWrite8- expected: 0 actual: %b", PCWrite);
- if(PCSource !== 2'b00) $display("j PCSource8- expected: 2'b00 actual: %b", PCSource);
- if(RegDst !== 0) $display("j RegDst8- expected: 0 actual: %b", RegDst);
- if(RegWrite !== 0) $display("j RegWrite8- expected:0 actual: %b", RegWrite);
- if(MemtoReg !== 1) $display("j MemtoReg8- expected: 1 actual: %b", MemtoReg);
- if(MemWrite !== 0) $display("j MemWrite8- expected: 0 actual: %b", MemWrite);
- #2; //s9
- if(MemRead !== 0) $display("j MemRead9- expected: 0 actual: %b", MemRead);
- if(ALUSrcA !== 0) $display("j ALUSrcA9- expected: 0 actual: %b", ALUSrcA);
- if(lorD !== 0) $display("j lorD9- expected: 0 actual: %b", lorD);
- if(IRWrite !== 0) $display("j IRWrite9- expected: 0 actual: %b", IRWrite);
- if(ALUSrcB !== 2'b11) $display("j ALUSrcB9- expected: 2'b11 actual: %b", ALUSrcB);
- if(ALUOp !== 2'b00) $display("j ALUOp9- expected: 2'b00 actual: %b", ALUOp);
- if(PCWrite !== 1) $display("j PCWrite9- expected: 1 actual: %b", PCWrite);
- if(PCSource !== 2'b10) $display("j PCSource9- expected: 2'b10 actual: %b", PCSource);
- if(RegDst !== 0) $display("j RegDst9- expected: 0 actual: %b", RegDst);
- if(RegWrite !== 0) $display("j RegWrite9- expected:0 actual: %b", RegWrite);
- if(MemtoReg !== 1) $display("j MemtoReg9- expected: 1 actual: %b", MemtoReg);
- if(MemWrite !== 0) $display("j MemWrite9- expected: 0 actual: %b", MemWrite);
- $display("Done J test...");
- #1;
- end
- always begin
- #1 Clk = !Clk;
- end
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement