Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Starting Jump command simulation
- # ================================
- # Check Fetch state
- # Check Decode / Register Fetch state
- # Check execute1 state
- # Finished Jump command simulation!
- #
- # Starting LW command simulation
- # ==============================
- # Check Fetch state
- # Check Decode / Register Fetch state
- # Check execute1 state
- # Check execute2 state
- # Check execute3 state
- # Finished LW command simulation!
- #
- # Starting SW command simulation
- # ==============================
- # Check Fetch state
- # Check Decode / Register Fetch state
- # Check execute1 state
- # Check execute2 state
- # Finished SW command simulation!
- #
- # Starting BEQ command simulation
- # ===============================
- # Check Fetch state
- # Check Decode / Register Fetch state
- # Check execute1 state
- # Finished BEQ command simulation!
- #
- # Starting RTYPE command simulation
- # =================================
- # Check Fetch state
- # Check Decode / Register Fetch state
- # Check execute1 state
- # Check execute2 state
- # failed on checking RTYPE command EXEC2 state on output ALUOp
- # failed on checking RTYPE command EXEC2 state on output ALUSrcA
- # Finished RTYPE command simulation!
- #
- # Done!
- module test_controller;
- reg [5:0] Op;
- reg Clk;
- wire [1:0] ALUOp, ALUSrcB, PCSource;
- wire PCWriteCond, PCWrite, lorD, MemRead, MemWrite, MemtoReg, IRWrite, ALUSrcA, RegWrite, RegDst;
- // OpCode constants
- parameter RTYPE = 6'h00;
- parameter LW = 6'h23;
- parameter SW = 6'h2b;
- parameter BEQ = 6'h04;
- parameter J = 6'h02;
- 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 = J;
- $display("Starting Jump command simulation");
- $display("================================");
- #1;
- $display("Check Fetch state");
- if (ALUOp !== 2'b00) $display("failed on checking JUMP command FETCH state on output ALUOp ");
- if (ALUSrcB !== 2'b01) $display("failed on checking JUMP command FETCH state on output ALUSrcB ");
- if (PCSource !== 2'b00) $display("failed on checking JUMP command FETCH state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking JUMP command FETCH state on output PCWriteCond ");
- if (PCWrite !== 1 ) $display("failed on checking JUMP command FETCH state on output PCWrite ");
- if (lorD !== 0 ) $display("failed on checking JUMP command FETCH state on output lorD ");
- if (MemRead !== 1 ) $display("failed on checking JUMP command FETCH state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking JUMP command FETCH state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking JUMP command FETCH state on output MemtoReg ");
- if (IRWrite !== 1 ) $display("failed on checking JUMP command FETCH state on output IRWrite ");
- if (ALUSrcA !== 0 ) $display("failed on checking JUMP command FETCH state on output ALUSrcA ");
- if (RegWrite !== 0 ) $display("failed on checking JUMP command FETCH state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking JUMP command FETCH state on output RegDst ");
- #2;
- $display("Check Decode / Register Fetch state");
- if (ALUOp !== 2'b00) $display("failed on checking JUMP command DECODE state on output ALUOp ");
- if (ALUSrcB !== 2'b11) $display("failed on checking JUMP command DECODE state on output ALUSrcB ");
- if (PCSource !== 2'b00) $display("failed on checking JUMP command DECODE state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking JUMP command DECODE state on output PCWriteCond ");
- if (PCWrite !== 0 ) $display("failed on checking JUMP command DECODE state on output PCWrite ");
- if (lorD !== 0 ) $display("failed on checking JUMP command DECODE state on output lorD ");
- if (MemRead !== 0 ) $display("failed on checking JUMP command DECODE state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking JUMP command DECODE state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking JUMP command DECODE state on output MemtoReg ");
- if (IRWrite !== 0 ) $display("failed on checking JUMP command DECODE state on output IRWrite ");
- if (ALUSrcA !== 0 ) $display("failed on checking JUMP command DECODE state on output ALUSrcA ");
- if (RegWrite !== 0 ) $display("failed on checking JUMP command DECODE state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking JUMP command DECODE state on output RegDst ");
- #2;
- $display("Check execute1 state");
- if (ALUOp !== 2'b00) $display("failed on checking JUMP command EXEC1 state on output ALUOp ");
- if (ALUSrcB !== 2'b00) $display("failed on checking JUMP command EXEC1 state on output ALUSrcB ");
- if (PCSource !== 2'b10) $display("failed on checking JUMP command EXEC1 state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking JUMP command EXEC1 state on output PCWriteCond ");
- if (PCWrite !== 1 ) $display("failed on checking JUMP command EXEC1 state on output PCWrite ");
- if (lorD !== 0 ) $display("failed on checking JUMP command EXEC1 state on output lorD ");
- if (MemRead !== 0 ) $display("failed on checking JUMP command EXEC1 state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking JUMP command EXEC1 state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking JUMP command EXEC1 state on output MemtoReg ");
- if (IRWrite !== 0 ) $display("failed on checking JUMP command EXEC1 state on output IRWrite ");
- if (ALUSrcA !== 0 ) $display("failed on checking JUMP command EXEC1 state on output ALUSrcA ");
- if (RegWrite !== 0 ) $display("failed on checking JUMP command EXEC1 state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking JUMP command EXEC1 state on output RegDst ");
- $display("Finished Jump command simulation!");
- $display(" ");
- $display("Starting LW command simulation");
- $display("==============================");
- Op = LW;
- #2;
- $display("Check Fetch state");
- if (ALUOp !== 2'b00) $display("failed on checking LW command FETCH state on output ALUOp ");
- if (ALUSrcB !== 2'b01) $display("failed on checking LW command FETCH state on output ALUSrcB ");
- if (PCSource !== 2'b00) $display("failed on checking LW command FETCH state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking LW command FETCH state on output PCWriteCond ");
- if (PCWrite !== 1 ) $display("failed on checking LW command FETCH state on output PCWrite ");
- if (lorD !== 0 ) $display("failed on checking LW command FETCH state on output lorD ");
- if (MemRead !== 1 ) $display("failed on checking LW command FETCH state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking LW command FETCH state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking LW command FETCH state on output MemtoReg ");
- if (IRWrite !== 1 ) $display("failed on checking LW command FETCH state on output IRWrite ");
- if (ALUSrcA !== 0 ) $display("failed on checking LW command FETCH state on output ALUSrcA ");
- if (RegWrite !== 0 ) $display("failed on checking LW command FETCH state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking LW command FETCH state on output RegDst ");
- #2;
- $display("Check Decode / Register Fetch state");
- if (ALUOp !== 2'b00) $display("failed on checking LW command DECODE state on output ALUOp ");
- if (ALUSrcB !== 2'b11) $display("failed on checking LW command DECODE state on output ALUSrcB ");
- if (PCSource !== 2'b00) $display("failed on checking LW command DECODE state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking LW command DECODE state on output PCWriteCond ");
- if (PCWrite !== 0 ) $display("failed on checking LW command DECODE state on output PCWrite ");
- if (lorD !== 0 ) $display("failed on checking LW command DECODE state on output lorD ");
- if (MemRead !== 0 ) $display("failed on checking LW command DECODE state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking LW command DECODE state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking LW command DECODE state on output MemtoReg ");
- if (IRWrite !== 0 ) $display("failed on checking LW command DECODE state on output IRWrite ");
- if (ALUSrcA !== 0 ) $display("failed on checking LW command DECODE state on output ALUSrcA ");
- if (RegWrite !== 0 ) $display("failed on checking LW command DECODE state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking LW command DECODE state on output RegDst ");
- #2;
- $display("Check execute1 state");
- if (ALUOp !== 2'b00) $display("failed on checking LW command EXEC1 state on output ALUOp ");
- if (ALUSrcB !== 2'b10) $display("failed on checking LW command EXEC1 state on output ALUSrcB ");
- if (PCSource !== 2'b00) $display("failed on checking LW command EXEC1 state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking LW command EXEC1 state on output PCWriteCond ");
- if (PCWrite !== 0 ) $display("failed on checking LW command EXEC1 state on output PCWrite ");
- if (lorD !== 0 ) $display("failed on checking LW command EXEC1 state on output lorD ");
- if (MemRead !== 0 ) $display("failed on checking LW command EXEC1 state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking LW command EXEC1 state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking LW command EXEC1 state on output MemtoReg ");
- if (IRWrite !== 0 ) $display("failed on checking LW command EXEC1 state on output IRWrite ");
- if (ALUSrcA !== 1 ) $display("failed on checking LW command EXEC1 state on output ALUSrcA ");
- if (RegWrite !== 0 ) $display("failed on checking LW command EXEC1 state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking LW command EXEC1 state on output RegDst ");
- #2;
- $display("Check execute2 state");
- if (ALUOp !== 2'b00) $display("failed on checking LW command EXEC2 state on output ALUOp ");
- if (ALUSrcB !== 2'b10) $display("failed on checking LW command EXEC2 state on output ALUSrcB ");
- if (PCSource !== 2'b00) $display("failed on checking LW command EXEC2 state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking LW command EXEC2 state on output PCWriteCond ");
- if (PCWrite !== 0 ) $display("failed on checking LW command EXEC2 state on output PCWrite ");
- if (lorD !== 1 ) $display("failed on checking LW command EXEC2 state on output lorD ");
- if (MemRead !== 1 ) $display("failed on checking LW command EXEC2 state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking LW command EXEC2 state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking LW command EXEC2 state on output MemtoReg ");
- if (IRWrite !== 0 ) $display("failed on checking LW command EXEC2 state on output IRWrite ");
- if (ALUSrcA !== 1 ) $display("failed on checking LW command EXEC2 state on output ALUSrcA ");
- if (RegWrite !== 0 ) $display("failed on checking LW command EXEC2 state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking LW command EXEC2 state on output RegDst ");
- #2;
- $display("Check execute3 state");
- if (ALUOp !== 2'b00) $display("failed on checking LW command EXEC3 state on output ALUOp ");
- if (ALUSrcB !== 2'b10) $display("failed on checking LW command EXEC3 state on output ALUSrcB ");
- if (PCSource !== 2'b00) $display("failed on checking LW command EXEC3 state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking LW command EXEC3 state on output PCWriteCond ");
- if (PCWrite !== 0 ) $display("failed on checking LW command EXEC3 state on output PCWrite ");
- if (lorD !== 0 ) $display("failed on checking LW command EXEC3 state on output lorD ");
- if (MemRead !== 0 ) $display("failed on checking LW command EXEC3 state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking LW command EXEC3 state on output MemWrite ");
- if (MemtoReg !== 1 ) $display("failed on checking LW command EXEC3 state on output MemtoReg ");
- if (IRWrite !== 0 ) $display("failed on checking LW command EXEC3 state on output IRWrite ");
- if (ALUSrcA !== 1 ) $display("failed on checking LW command EXEC3 state on output ALUSrcA ");
- if (RegWrite !== 1 ) $display("failed on checking LW command EXEC3 state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking LW command EXEC3 state on output RegDst ");
- $display("Finished LW command simulation!");
- $display(" ");
- $display("Starting SW command simulation");
- $display("==============================");
- Op = SW;
- #2;
- $display("Check Fetch state");
- if (ALUOp !== 2'b00) $display("failed on checking SW command FETCH state on output ALUOp ");
- if (ALUSrcB !== 2'b01) $display("failed on checking SW command FETCH state on output ALUSrcB ");
- if (PCSource !== 2'b00) $display("failed on checking SW command FETCH state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking SW command FETCH state on output PCWriteCond ");
- if (PCWrite !== 1 ) $display("failed on checking SW command FETCH state on output PCWrite ");
- if (lorD !== 0 ) $display("failed on checking SW command FETCH state on output lorD ");
- if (MemRead !== 1 ) $display("failed on checking SW command FETCH state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking SW command FETCH state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking SW command FETCH state on output MemtoReg ");
- if (IRWrite !== 1 ) $display("failed on checking SW command FETCH state on output IRWrite ");
- if (ALUSrcA !== 0 ) $display("failed on checking SW command FETCH state on output ALUSrcA ");
- if (RegWrite !== 0 ) $display("failed on checking SW command FETCH state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking SW command FETCH state on output RegDst ");
- #2;
- $display("Check Decode / Register Fetch state");
- if (ALUOp !== 2'b00) $display("failed on checking SW command DECODE state on output ALUOp ");
- if (ALUSrcB !== 2'b11) $display("failed on checking SW command DECODE state on output ALUSrcB ");
- if (PCSource !== 2'b00) $display("failed on checking SW command DECODE state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking SW command DECODE state on output PCWriteCond ");
- if (PCWrite !== 0 ) $display("failed on checking SW command DECODE state on output PCWrite ");
- if (lorD !== 0 ) $display("failed on checking SW command DECODE state on output lorD ");
- if (MemRead !== 0 ) $display("failed on checking SW command DECODE state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking SW command DECODE state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking SW command DECODE state on output MemtoReg ");
- if (IRWrite !== 0 ) $display("failed on checking SW command DECODE state on output IRWrite ");
- if (ALUSrcA !== 0 ) $display("failed on checking SW command DECODE state on output ALUSrcA ");
- if (RegWrite !== 0 ) $display("failed on checking SW command DECODE state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking SW command DECODE state on output RegDst ");
- #2;
- $display("Check execute1 state");
- if (ALUOp !== 2'b00) $display("failed on checking SW command EXEC1 state on output ALUOp ");
- if (ALUSrcB !== 2'b10) $display("failed on checking SW command EXEC1 state on output ALUSrcB ");
- if (PCSource !== 2'b00) $display("failed on checking SW command EXEC1 state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking SW command EXEC1 state on output PCWriteCond ");
- if (PCWrite !== 0 ) $display("failed on checking SW command EXEC1 state on output PCWrite ");
- if (lorD !== 0 ) $display("failed on checking SW command EXEC1 state on output lorD ");
- if (MemRead !== 0 ) $display("failed on checking SW command EXEC1 state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking SW command EXEC1 state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking SW command EXEC1 state on output MemtoReg ");
- if (IRWrite !== 0 ) $display("failed on checking SW command EXEC1 state on output IRWrite ");
- if (ALUSrcA !== 1 ) $display("failed on checking SW command EXEC1 state on output ALUSrcA ");
- if (RegWrite !== 0 ) $display("failed on checking SW command EXEC1 state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking SW command EXEC1 state on output RegDst ");
- #2;
- $display("Check execute2 state");
- if (ALUOp !== 2'b00) $display("failed on checking SW command EXEC2 state on output ALUOp ");
- if (ALUSrcB !== 2'b10) $display("failed on checking SW command EXEC2 state on output ALUSrcB ");
- if (PCSource !== 2'b00) $display("failed on checking SW command EXEC2 state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking SW command EXEC2 state on output PCWriteCond ");
- if (PCWrite !== 0 ) $display("failed on checking SW command EXEC2 state on output PCWrite ");
- if (lorD !== 1 ) $display("failed on checking SW command EXEC2 state on output lorD ");
- if (MemRead !== 0 ) $display("failed on checking SW command EXEC2 state on output MemRead ");
- if (MemWrite !== 1 ) $display("failed on checking SW command EXEC2 state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking SW command EXEC2 state on output MemtoReg ");
- if (IRWrite !== 0 ) $display("failed on checking SW command EXEC2 state on output IRWrite ");
- if (ALUSrcA !== 1 ) $display("failed on checking SW command EXEC2 state on output ALUSrcA ");
- if (RegWrite !== 0 ) $display("failed on checking SW command EXEC2 state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking SW command EXEC2 state on output RegDst ");
- $display("Finished SW command simulation!");
- $display(" ");
- $display("Starting BEQ command simulation");
- $display("===============================");
- Op = BEQ;
- #2;
- $display("Check Fetch state");
- if (ALUOp !== 2'b00) $display("failed on checking BEQ command FETCH state on output ALUOp ");
- if (ALUSrcB !== 2'b01) $display("failed on checking BEQ command FETCH state on output ALUSrcB ");
- if (PCSource !== 2'b00) $display("failed on checking BEQ command FETCH state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking BEQ command FETCH state on output PCWriteCond ");
- if (PCWrite !== 1 ) $display("failed on checking BEQ command FETCH state on output PCWrite ");
- if (lorD !== 0 ) $display("failed on checking BEQ command FETCH state on output lorD ");
- if (MemRead !== 1 ) $display("failed on checking BEQ command FETCH state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking BEQ command FETCH state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking BEQ command FETCH state on output MemtoReg ");
- if (IRWrite !== 1 ) $display("failed on checking BEQ command FETCH state on output IRWrite ");
- if (ALUSrcA !== 0 ) $display("failed on checking BEQ command FETCH state on output ALUSrcA ");
- if (RegWrite !== 0 ) $display("failed on checking BEQ command FETCH state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking BEQ command FETCH state on output RegDst ");
- #2;
- $display("Check Decode / Register Fetch state");
- if (ALUOp !== 2'b00) $display("failed on checking BEQ command DECODE state on output ALUOp ");
- if (ALUSrcB !== 2'b11) $display("failed on checking BEQ command DECODE state on output ALUSrcB ");
- if (PCSource !== 2'b00) $display("failed on checking BEQ command DECODE state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking BEQ command DECODE state on output PCWriteCond ");
- if (PCWrite !== 0 ) $display("failed on checking BEQ command DECODE state on output PCWrite ");
- if (lorD !== 0 ) $display("failed on checking BEQ command DECODE state on output lorD ");
- if (MemRead !== 0 ) $display("failed on checking BEQ command DECODE state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking BEQ command DECODE state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking BEQ command DECODE state on output MemtoReg ");
- if (IRWrite !== 0 ) $display("failed on checking BEQ command DECODE state on output IRWrite ");
- if (ALUSrcA !== 0 ) $display("failed on checking BEQ command DECODE state on output ALUSrcA ");
- if (RegWrite !== 0 ) $display("failed on checking BEQ command DECODE state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking BEQ command DECODE state on output RegDst ");
- #2;
- $display("Check execute1 state");
- if (ALUOp !== 2'b01) $display("failed on checking BEQ command EXEC1 state on output ALUOp ");
- if (ALUSrcB !== 2'b00) $display("failed on checking BEQ command EXEC1 state on output ALUSrcB ");
- if (PCSource !== 2'b01) $display("failed on checking BEQ command EXEC1 state on output PCSource ");
- if (PCWriteCond !== 1 ) $display("failed on checking BEQ command EXEC1 state on output PCWriteCond ");
- if (PCWrite !== 0 ) $display("failed on checking BEQ command EXEC1 state on output PCWrite ");
- if (lorD !== 0 ) $display("failed on checking BEQ command EXEC1 state on output lorD ");
- if (MemRead !== 0 ) $display("failed on checking BEQ command EXEC1 state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking BEQ command EXEC1 state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking BEQ command EXEC1 state on output MemtoReg ");
- if (IRWrite !== 0 ) $display("failed on checking BEQ command EXEC1 state on output IRWrite ");
- if (ALUSrcA !== 1 ) $display("failed on checking BEQ command EXEC1 state on output ALUSrcA ");
- if (RegWrite !== 0 ) $display("failed on checking BEQ command EXEC1 state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking BEQ command EXEC1 state on output RegDst ");
- $display("Finished BEQ command simulation!");
- $display(" ");
- $display("Starting RTYPE command simulation");
- $display("=================================");
- Op = RTYPE;
- #2;
- $display("Check Fetch state");
- if (ALUOp !== 2'b00) $display("failed on checking RTYPE command FETCH state on output ALUOp ");
- if (ALUSrcB !== 2'b01) $display("failed on checking RTYPE command FETCH state on output ALUSrcB ");
- if (PCSource !== 2'b00) $display("failed on checking RTYPE command FETCH state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking RTYPE command FETCH state on output PCWriteCond ");
- if (PCWrite !== 1 ) $display("failed on checking RTYPE command FETCH state on output PCWrite ");
- if (lorD !== 0 ) $display("failed on checking RTYPE command FETCH state on output lorD ");
- if (MemRead !== 1 ) $display("failed on checking RTYPE command FETCH state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking RTYPE command FETCH state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking RTYPE command FETCH state on output MemtoReg ");
- if (IRWrite !== 1 ) $display("failed on checking RTYPE command FETCH state on output IRWrite ");
- if (ALUSrcA !== 0 ) $display("failed on checking RTYPE command FETCH state on output ALUSrcA ");
- if (RegWrite !== 0 ) $display("failed on checking RTYPE command FETCH state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking RTYPE command FETCH state on output RegDst ");
- #2;
- $display("Check Decode / Register Fetch state");
- if (ALUOp !== 2'b00) $display("failed on checking RTYPE command DECODE state on output ALUOp ");
- if (ALUSrcB !== 2'b11) $display("failed on checking RTYPE command DECODE state on output ALUSrcB ");
- if (PCSource !== 2'b00) $display("failed on checking RTYPE command DECODE state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking RTYPE command DECODE state on output PCWriteCond ");
- if (PCWrite !== 0 ) $display("failed on checking RTYPE command DECODE state on output PCWrite ");
- if (lorD !== 0 ) $display("failed on checking RTYPE command DECODE state on output lorD ");
- if (MemRead !== 0 ) $display("failed on checking RTYPE command DECODE state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking RTYPE command DECODE state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking RTYPE command DECODE state on output MemtoReg ");
- if (IRWrite !== 0 ) $display("failed on checking RTYPE command DECODE state on output IRWrite ");
- if (ALUSrcA !== 0 ) $display("failed on checking RTYPE command DECODE state on output ALUSrcA ");
- if (RegWrite !== 0 ) $display("failed on checking RTYPE command DECODE state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking RTYPE command DECODE state on output RegDst ");
- #2;
- $display("Check execute1 state");
- if (ALUOp !== 2'b10) $display("failed on checking RTYPE command EXEC1 state on output ALUOp ");
- if (ALUSrcB !== 2'b00) $display("failed on checking RTYPE command EXEC1 state on output ALUSrcB ");
- if (PCSource !== 2'b00) $display("failed on checking RTYPE command EXEC1 state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking RTYPE command EXEC1 state on output PCWriteCond ");
- if (PCWrite !== 0 ) $display("failed on checking RTYPE command EXEC1 state on output PCWrite ");
- if (lorD !== 0 ) $display("failed on checking RTYPE command EXEC1 state on output lorD ");
- if (MemRead !== 0 ) $display("failed on checking RTYPE command EXEC1 state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking RTYPE command EXEC1 state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking RTYPE command EXEC1 state on output MemtoReg ");
- if (IRWrite !== 0 ) $display("failed on checking RTYPE command EXEC1 state on output IRWrite ");
- if (ALUSrcA !== 1 ) $display("failed on checking RTYPE command EXEC1 state on output ALUSrcA ");
- if (RegWrite !== 0 ) $display("failed on checking RTYPE command EXEC1 state on output RegWrite ");
- if (RegDst !== 0 ) $display("failed on checking RTYPE command EXEC1 state on output RegDst ");
- #2;
- $display("Check execute2 state");
- if (ALUOp !== 2'b10) $display("failed on checking RTYPE command EXEC2 state on output ALUOp ");
- if (ALUSrcB !== 2'b00) $display("failed on checking RTYPE command EXEC2 state on output ALUSrcB ");
- if (PCSource !== 2'b00) $display("failed on checking RTYPE command EXEC2 state on output PCSource ");
- if (PCWriteCond !== 0 ) $display("failed on checking RTYPE command EXEC2 state on output PCWriteCond ");
- if (PCWrite !== 0 ) $display("failed on checking RTYPE command EXEC2 state on output PCWrite ");
- if (lorD !== 0 ) $display("failed on checking RTYPE command EXEC2 state on output lorD ");
- if (MemRead !== 0 ) $display("failed on checking RTYPE command EXEC2 state on output MemRead ");
- if (MemWrite !== 0 ) $display("failed on checking RTYPE command EXEC2 state on output MemWrite ");
- if (MemtoReg !== 0 ) $display("failed on checking RTYPE command EXEC2 state on output MemtoReg ");
- if (IRWrite !== 0 ) $display("failed on checking RTYPE command EXEC2 state on output IRWrite ");
- if (ALUSrcA !== 1 ) $display("failed on checking RTYPE command EXEC2 state on output ALUSrcA ");
- if (RegWrite !== 1 ) $display("failed on checking RTYPE command EXEC2 state on output RegWrite ");
- if (RegDst !== 1 ) $display("failed on checking RTYPE command EXEC2 state on output RegDst ");
- $display("Finished RTYPE command simulation!");
- $display(" ");
- $display("Done!");
- end
- always begin
- #1 Clk = !Clk;
- end
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement