mirror of
https://github.com/supleed2/ELEC50010-IAC-CW.git
synced 2024-12-23 05:45:47 +00:00
Delete from source files and the testbench
This commit is contained in:
parent
2d9cca262d
commit
cfebb403ba
|
@ -135,7 +135,6 @@ end
|
||||||
|
|
||||||
SLL: begin
|
SLL: begin
|
||||||
ALURes = B << shamt;
|
ALURes = B << shamt;
|
||||||
$display("ALURES SLL: %h", ALURes);
|
|
||||||
end
|
end
|
||||||
|
|
||||||
SLLV: begin
|
SLLV: begin
|
||||||
|
@ -169,7 +168,6 @@ end
|
||||||
end
|
end
|
||||||
|
|
||||||
LES: begin
|
LES: begin
|
||||||
$display("ALU A: %h B: %h", $signed(A), $signed(B));
|
|
||||||
if ($signed(A) < $signed(B)) begin
|
if ($signed(A) < $signed(B)) begin
|
||||||
ALUCond = 1;
|
ALUCond = 1;
|
||||||
end
|
end
|
||||||
|
@ -248,7 +246,6 @@ end
|
||||||
end
|
end
|
||||||
|
|
||||||
DIVU: begin
|
DIVU: begin
|
||||||
$display("ALU A: %h B: %h", A, B);
|
|
||||||
temp_Lo = A / B;
|
temp_Lo = A / B;
|
||||||
temp_Hi = A % B;
|
temp_Hi = A % B;
|
||||||
end
|
end
|
||||||
|
|
|
@ -89,13 +89,10 @@ always @(*) begin
|
||||||
//CtrlRegDst logic
|
//CtrlRegDst logic
|
||||||
if((op==ADDIU) || (op==ANDI) || (op==LB) || (op==LBU) || (op==LH) || (op==LHU) || (op==LUI) || (op==LW) || (op==LWL) || (op==LWR) || (op==ORI) || (op==SLTI) || (op==SLTIU) || (op==XORI))begin
|
if((op==ADDIU) || (op==ANDI) || (op==LB) || (op==LBU) || (op==LH) || (op==LHU) || (op==LUI) || (op==LW) || (op==LWL) || (op==LWR) || (op==ORI) || (op==SLTI) || (op==SLTIU) || (op==XORI))begin
|
||||||
CtrlRegDst = 2'd0; //Write address comes from rt
|
CtrlRegDst = 2'd0; //Write address comes from rt
|
||||||
$display("CTRLREGDST: Rt");
|
|
||||||
end else if ((op==SPECIAL)&&((funct==ADDU) || (funct==AND) || (funct==JALR) || (funct==MFLO) || (funct==MFHI) || (funct==OR) || (funct==SLL) || (funct==SLLV) || (funct==SLT) || (funct==SLTU) || (funct==SRA) || (funct==SRAV) || (funct==SRL) || (funct==SRLV) || (funct==SUBU) || (funct==XOR)))begin
|
end else if ((op==SPECIAL)&&((funct==ADDU) || (funct==AND) || (funct==JALR) || (funct==MFLO) || (funct==MFHI) || (funct==OR) || (funct==SLL) || (funct==SLLV) || (funct==SLT) || (funct==SLTU) || (funct==SRA) || (funct==SRAV) || (funct==SRL) || (funct==SRLV) || (funct==SUBU) || (funct==XOR)))begin
|
||||||
CtrlRegDst = 2'd1; //Write address comes from rd
|
CtrlRegDst = 2'd1; //Write address comes from rd
|
||||||
$display("CTRLREGDST: Rd");
|
|
||||||
end else if ((op == JAL) || ((op==REGIMM)&&((rt==BGEZAL) || (rt==BLTZAL))))begin
|
end else if ((op == JAL) || ((op==REGIMM)&&((rt==BGEZAL) || (rt==BLTZAL))))begin
|
||||||
CtrlRegDst = 2'd2; //const reg 31, for writing to the link register
|
CtrlRegDst = 2'd2; //const reg 31, for writing to the link register
|
||||||
$display("CTRLREGDST: Link");
|
|
||||||
end else begin CtrlRegDst = 1'bx; end//Not all instructions are encompassed so, added incase for debug purposes
|
end else begin CtrlRegDst = 1'bx; end//Not all instructions are encompassed so, added incase for debug purposes
|
||||||
|
|
||||||
//CtrlPC logic
|
//CtrlPC logic
|
||||||
|
@ -103,21 +100,17 @@ always @(*) begin
|
||||||
CtrlPC = 2'd1; // Branches - Jumps relative to PC
|
CtrlPC = 2'd1; // Branches - Jumps relative to PC
|
||||||
end else if((op==J) || (op==JAL))begin
|
end else if((op==J) || (op==JAL))begin
|
||||||
CtrlPC = 2'd2; // Jumps within 256MB Region using 26-bit immediate in J type instruction
|
CtrlPC = 2'd2; // Jumps within 256MB Region using 26-bit immediate in J type instruction
|
||||||
$display("Jump PC Ctrl");
|
|
||||||
end else if((op==SPECIAL)&&((funct==JR) || (funct==JALR)))begin
|
end else if((op==SPECIAL)&&((funct==JR) || (funct==JALR)))begin
|
||||||
CtrlPC = 2'd3; // Jumps using Register.
|
CtrlPC = 2'd3; // Jumps using Register.
|
||||||
//$display("Ctrl PC Jump Register");
|
end else begin CtrlPC = 2'd0; end // No jumps or branches, just increment to next word
|
||||||
end else begin CtrlPC = 2'd0; /*/$display("Ctrl PC No Jump/Branch");*/end // No jumps or branches, just increment to next word
|
|
||||||
|
|
||||||
//CtrlMemRead and CtrlMemtoReg logic -- Interesting quirk that they have the same logic where both are concerned. Makes sense bc you'd only want to select the read data out when the memory itself is read enabled.
|
//CtrlMemRead and CtrlMemtoReg logic -- Interesting quirk that they have the same logic where both are concerned. Makes sense bc you'd only want to select the read data out when the memory itself is read enabled.
|
||||||
if((op==LB) || (op==LBU) || (op==LH) || (op==LHU) || (op==LW) || (op==LWL) || (op==LWR))begin
|
if((op==LB) || (op==LBU) || (op==LH) || (op==LHU) || (op==LW) || (op==LWL) || (op==LWR))begin
|
||||||
CtrlMemRead = 1;//Memory is read enabled
|
CtrlMemRead = 1;//Memory is read enabled
|
||||||
CtrlMemtoReg = 3'd1;//write data port of regfile is fed from data memory
|
CtrlMemtoReg = 3'd1;//write data port of regfile is fed from data memory
|
||||||
$display("Memory read enabled");
|
|
||||||
end else if ((op==ADDIU) || (op==ANDI) || (op==ORI) || (op==LUI) || (op==SLTI) || (op==SLTIU) || (op==XORI) || ((op==SPECIAL)&&((funct==ADDU) || (funct==AND) || (funct==OR) || (funct==SLL) || (funct==SLLV) || (funct==SLT) || (funct==SLTU) || (funct==SRA) || (funct==SRAV) || (funct==SRL) || (funct==SRLV) || (funct==SUBU) || (funct==XOR))))begin
|
end else if ((op==ADDIU) || (op==ANDI) || (op==ORI) || (op==LUI) || (op==SLTI) || (op==SLTIU) || (op==XORI) || ((op==SPECIAL)&&((funct==ADDU) || (funct==AND) || (funct==OR) || (funct==SLL) || (funct==SLLV) || (funct==SLT) || (funct==SLTU) || (funct==SRA) || (funct==SRAV) || (funct==SRL) || (funct==SRLV) || (funct==SUBU) || (funct==XOR))))begin
|
||||||
CtrlMemRead = 0;//Memory is read disabled
|
CtrlMemRead = 0;//Memory is read disabled
|
||||||
CtrlMemtoReg = 3'd0;//write data port of regfile is fed from ALURes
|
CtrlMemtoReg = 3'd0;//write data port of regfile is fed from ALURes
|
||||||
$display("Memory read disabled");
|
|
||||||
end else if ((op==JAL) || ((op==SPECIAL)&&(funct == JALR)) || ((op==REGIMM)&&((rt==BGEZAL) || (rt==BLTZAL))))begin
|
end else if ((op==JAL) || ((op==SPECIAL)&&(funct == JALR)) || ((op==REGIMM)&&((rt==BGEZAL) || (rt==BLTZAL))))begin
|
||||||
CtrlMemtoReg = 3'd2;//write data port of regfile is fed from PC + 8
|
CtrlMemtoReg = 3'd2;//write data port of regfile is fed from PC + 8
|
||||||
end else if ((op==SPECIAL)&&(funct == MFHI))begin
|
end else if ((op==SPECIAL)&&(funct == MFHI))begin
|
||||||
|
@ -125,11 +118,10 @@ always @(*) begin
|
||||||
end else if ((op==SPECIAL)&&(funct == MFLO))begin
|
end else if ((op==SPECIAL)&&(funct == MFLO))begin
|
||||||
CtrlMemtoReg = 3'd4;//write data port of regfile is fed from ALULo
|
CtrlMemtoReg = 3'd4;//write data port of regfile is fed from ALULo
|
||||||
end else begin CtrlMemRead = 1'bx;end//Not all instructions are encompassed so, added incase for debug purposes
|
end else begin CtrlMemRead = 1'bx;end//Not all instructions are encompassed so, added incase for debug purposes
|
||||||
//$display("OP: %d, Funct: %d", op, funct);
|
|
||||||
//CtrlALUOp Logic
|
//CtrlALUOp Logic
|
||||||
if((op==ADDIU) || ((op==SPECIAL)&&(funct==ADDU)))begin
|
if((op==ADDIU) || ((op==SPECIAL)&&(funct==ADDU)))begin
|
||||||
CtrlALUOp = 5'd0; //ADD from ALUOps
|
CtrlALUOp = 5'd0; //ADD from ALUOps
|
||||||
$display("ALU OP = 0 (ADDU/ADDIU)");
|
|
||||||
end else if((op==ANDI) || ((op==SPECIAL)&&(funct==AND)))begin
|
end else if((op==ANDI) || ((op==SPECIAL)&&(funct==AND)))begin
|
||||||
CtrlALUOp = 5'd4;//AND from ALUOps
|
CtrlALUOp = 5'd4;//AND from ALUOps
|
||||||
end else if(op==BEQ) begin
|
end else if(op==BEQ) begin
|
||||||
|
@ -146,12 +138,10 @@ always @(*) begin
|
||||||
CtrlALUOp = 5'd18;//NEQ from ALUOps
|
CtrlALUOp = 5'd18;//NEQ from ALUOps
|
||||||
end else if((op==SPECIAL)&&(funct==DIV))begin
|
end else if((op==SPECIAL)&&(funct==DIV))begin
|
||||||
CtrlALUOp = 5'd3;//DIV from ALUOps
|
CtrlALUOp = 5'd3;//DIV from ALUOps
|
||||||
$display("DIV CONTROL ALUOps");
|
|
||||||
end else if((op==SPECIAL)&&(funct==DIVU))begin
|
end else if((op==SPECIAL)&&(funct==DIVU))begin
|
||||||
CtrlALUOp = 5'd23;//DIVU from ALUOps
|
CtrlALUOp = 5'd23;//DIVU from ALUOps
|
||||||
end else if((op==LB) || (op==LBU) || (op==LH) || (op==LHU) || (op==LW) || (op==LWL) || (op==LWR) || (op==SB) || (op==SH) || (op==SW))begin
|
end else if((op==LB) || (op==LBU) || (op==LH) || (op==LHU) || (op==LW) || (op==LWL) || (op==LWR) || (op==SB) || (op==SH) || (op==SW))begin
|
||||||
CtrlALUOp = 5'd0;//ADD from ALUOps
|
CtrlALUOp = 5'd0;//ADD from ALUOps
|
||||||
$display("LB IN CONTROL");
|
|
||||||
end else if(op==LUI)begin
|
end else if(op==LUI)begin
|
||||||
CtrlALUOp = 5'd7;//SLL from ALUOps
|
CtrlALUOp = 5'd7;//SLL from ALUOps
|
||||||
end else if((op==SPECIAL)&&((funct==MTHI)))begin
|
end else if((op==SPECIAL)&&((funct==MTHI)))begin
|
||||||
|
@ -166,31 +156,24 @@ always @(*) begin
|
||||||
CtrlALUOp = 5'd5;//OR from ALUOps
|
CtrlALUOp = 5'd5;//OR from ALUOps
|
||||||
end else if((op==SPECIAL)&&(funct==SLL))begin
|
end else if((op==SPECIAL)&&(funct==SLL))begin
|
||||||
CtrlALUOp = 5'd7;//SLL from ALUOps
|
CtrlALUOp = 5'd7;//SLL from ALUOps
|
||||||
$display("ALU Op = 7 (SLL)");
|
|
||||||
end else if((op==SPECIAL)&&(funct==SLLV))begin
|
end else if((op==SPECIAL)&&(funct==SLLV))begin
|
||||||
CtrlALUOp = 5'd8;//SLLV from ALUOps
|
CtrlALUOp = 5'd8;//SLLV from ALUOps
|
||||||
$display("ALU Op = 9 (SLLV)");
|
|
||||||
end else if((op==SPECIAL)&&(funct==SRA))begin
|
end else if((op==SPECIAL)&&(funct==SRA))begin
|
||||||
CtrlALUOp = 5'd11;//SRA from ALUOps
|
CtrlALUOp = 5'd11;//SRA from ALUOps
|
||||||
$display("ALU Op = 11 (SRA)");
|
|
||||||
end else if((op==SPECIAL)&&(funct==SRAV))begin
|
end else if((op==SPECIAL)&&(funct==SRAV))begin
|
||||||
CtrlALUOp = 5'd12;//SRAV from ALUOps
|
CtrlALUOp = 5'd12;//SRAV from ALUOps
|
||||||
end else if((op==SPECIAL)&&(funct==SRL))begin
|
end else if((op==SPECIAL)&&(funct==SRL))begin
|
||||||
$display("ALU Op = 7 (SRL)");
|
|
||||||
CtrlALUOp = 5'd9;//SRL from ALUOps
|
CtrlALUOp = 5'd9;//SRL from ALUOps
|
||||||
end else if((op==SPECIAL)&&(funct==SRLV))begin
|
end else if((op==SPECIAL)&&(funct==SRLV))begin
|
||||||
CtrlALUOp = 5'd10;//SRLV from ALUOps
|
CtrlALUOp = 5'd10;//SRLV from ALUOps
|
||||||
end else if((op==SLTI) || ((op==SPECIAL)&&(funct==SLT)))begin
|
end else if((op==SLTI) || ((op==SPECIAL)&&(funct==SLT)))begin
|
||||||
CtrlALUOp = 5'd20;//SLT from ALUOps
|
CtrlALUOp = 5'd20;//SLT from ALUOps
|
||||||
$display("ALU Op = 20 (SLT/SLTI)");
|
|
||||||
end else if((op==SLTIU) || ((op==SPECIAL)&&(funct==SLTU)))begin
|
end else if((op==SLTIU) || ((op==SPECIAL)&&(funct==SLTU)))begin
|
||||||
CtrlALUOp = 5'd21;//SLTU from ALUOps
|
CtrlALUOp = 5'd21;//SLTU from ALUOps
|
||||||
$display("ALU Op = 21 (SLTU/SLTIU)");
|
|
||||||
end else if((op==SPECIAL)&&(funct==SUBU))begin
|
end else if((op==SPECIAL)&&(funct==SUBU))begin
|
||||||
CtrlALUOp = 5'd1;//SUB from ALUOps
|
CtrlALUOp = 5'd1;//SUB from ALUOps
|
||||||
end else if((op==XORI) || ((op==SPECIAL)&&(funct==XOR)))begin
|
end else if((op==XORI) || ((op==SPECIAL)&&(funct==XOR)))begin
|
||||||
CtrlALUOp = 5'd6;//XOR from ALUOps
|
CtrlALUOp = 5'd6;//XOR from ALUOps
|
||||||
$display("ALU Op = 6 (XOR)");
|
|
||||||
end else begin
|
end else begin
|
||||||
CtrlALUOp = 5'bxxxxx;
|
CtrlALUOp = 5'bxxxxx;
|
||||||
end
|
end
|
||||||
|
@ -200,7 +183,6 @@ always @(*) begin
|
||||||
Ctrlshamt = Instr[10:6];// Shift amount piped in from the instruction
|
Ctrlshamt = Instr[10:6];// Shift amount piped in from the instruction
|
||||||
end else if(op == LUI)begin
|
end else if(op == LUI)begin
|
||||||
Ctrlshamt = 5'd16;//Used specifically to implement LUI as the instruction itslef does not include shamt
|
Ctrlshamt = 5'd16;//Used specifically to implement LUI as the instruction itslef does not include shamt
|
||||||
$display("LUI SHIFTING");
|
|
||||||
end else begin Ctrlshamt = 5'bxxxxx;end
|
end else begin Ctrlshamt = 5'bxxxxx;end
|
||||||
|
|
||||||
//CtrlMemWrite logic
|
//CtrlMemWrite logic
|
||||||
|
@ -211,7 +193,6 @@ always @(*) begin
|
||||||
//CtrlSpcRegWriteEn logic
|
//CtrlSpcRegWriteEn logic
|
||||||
if((op==SPECIAL)&&((funct==MTHI) || (funct==MTLO) || (funct==MULT) || (funct==MULTU) || (funct==DIV) || (funct==DIVU)))begin
|
if((op==SPECIAL)&&((funct==MTHI) || (funct==MTLO) || (funct==MULT) || (funct==MULTU) || (funct==DIV) || (funct==DIVU)))begin
|
||||||
CtrlSpcRegWriteEn = 1;//Special register Hi and Lo are write enabled
|
CtrlSpcRegWriteEn = 1;//Special register Hi and Lo are write enabled
|
||||||
$display("Temp being written");
|
|
||||||
end else begin CtrlSpcRegWriteEn = 0;end//default is 0 to ensure no accidental overwriting.
|
end else begin CtrlSpcRegWriteEn = 0;end//default is 0 to ensure no accidental overwriting.
|
||||||
|
|
||||||
//CtrlALUSrc logic
|
//CtrlALUSrc logic
|
||||||
|
@ -226,7 +207,6 @@ always @(*) begin
|
||||||
//CtrlRegWrite logic
|
//CtrlRegWrite logic
|
||||||
if((op==ADDIU) || (op==ANDI) || (op==LB) || (op==LBU) || (op==LH) || (op==LHU) || (op==LUI) || (op==LW) || (op==LWL) || (op==LWR) || (op==ORI) || (op==JAL) || (op==SLTI) || (op==XORI) || ((op==REGIMM)&&((rt==BGEZAL) || (rt==BLTZAL))) || ((op==SPECIAL)&&((funct==ADDU) || (funct==AND) || (funct==MFLO) || (funct==MFHI) || (funct==OR) || (funct==SLL) || (funct==SLLV) || (funct==SLT) || (funct==SLTU) || (funct==SRA) || (funct==SRAV) || (funct==SRL) || (funct==SRLV) || (funct==SUBU) || (funct==JALR) || (funct==XOR)))) begin
|
if((op==ADDIU) || (op==ANDI) || (op==LB) || (op==LBU) || (op==LH) || (op==LHU) || (op==LUI) || (op==LW) || (op==LWL) || (op==LWR) || (op==ORI) || (op==JAL) || (op==SLTI) || (op==XORI) || ((op==REGIMM)&&((rt==BGEZAL) || (rt==BLTZAL))) || ((op==SPECIAL)&&((funct==ADDU) || (funct==AND) || (funct==MFLO) || (funct==MFHI) || (funct==OR) || (funct==SLL) || (funct==SLLV) || (funct==SLT) || (funct==SLTU) || (funct==SRA) || (funct==SRAV) || (funct==SRL) || (funct==SRLV) || (funct==SUBU) || (funct==JALR) || (funct==XOR)))) begin
|
||||||
CtrlRegWrite = 1;//The Registers are Write Enabled
|
CtrlRegWrite = 1;//The Registers are Write Enabled
|
||||||
$display("OPcode mflo: %h", op);
|
|
||||||
end else begin CtrlRegWrite = 0;end // The Registers are Write Disabled
|
end else begin CtrlRegWrite = 0;end // The Registers are Write Disabled
|
||||||
end
|
end
|
||||||
endmodule
|
endmodule
|
|
@ -61,7 +61,6 @@ always @(*) begin
|
||||||
end
|
end
|
||||||
3'd2:begin
|
3'd2:begin
|
||||||
in_writedata = (out_pc_out + 32'd8);//Output from PC +8.
|
in_writedata = (out_pc_out + 32'd8);//Output from PC +8.
|
||||||
$display("LINKING-----------<: %h", in_writedata);
|
|
||||||
end
|
end
|
||||||
3'd3:begin
|
3'd3:begin
|
||||||
in_writedata = (out_ALUHi);
|
in_writedata = (out_ALUHi);
|
||||||
|
|
|
@ -29,7 +29,6 @@ always_ff @(negedge clk) begin
|
||||||
if (writereg == 5'b00000) begin
|
if (writereg == 5'b00000) begin
|
||||||
// skip writing if rd is $0
|
// skip writing if rd is $0
|
||||||
end else if (regwrite) begin
|
end else if (regwrite) begin
|
||||||
$display("%b", opcode);
|
|
||||||
case (opcode)
|
case (opcode)
|
||||||
6'b100000: begin //lb, load byte
|
6'b100000: begin //lb, load byte
|
||||||
case (readdata1[1:0])
|
case (readdata1[1:0])
|
||||||
|
@ -38,8 +37,6 @@ always_ff @(negedge clk) begin
|
||||||
2'b10: memory[writereg] <= {{24{writedata[23]}}, writedata[23:16]};
|
2'b10: memory[writereg] <= {{24{writedata[23]}}, writedata[23:16]};
|
||||||
2'b11: memory[writereg] <= {{24{writedata[31]}}, writedata[31:24]};
|
2'b11: memory[writereg] <= {{24{writedata[31]}}, writedata[31:24]};
|
||||||
endcase // readdata1[1:0]
|
endcase // readdata1[1:0]
|
||||||
$display("writedata %h", writedata);
|
|
||||||
$display("memory writereg %h", memory[writereg]);
|
|
||||||
end
|
end
|
||||||
6'b100100: begin //lbu, load byte unsigned
|
6'b100100: begin //lbu, load byte unsigned
|
||||||
case (readdata1[1:0])
|
case (readdata1[1:0])
|
||||||
|
@ -79,7 +76,6 @@ always_ff @(negedge clk) begin
|
||||||
end
|
end
|
||||||
default: begin
|
default: begin
|
||||||
memory[writereg] <= writedata; //most instructions
|
memory[writereg] <= writedata; //most instructions
|
||||||
$display("Write %d in regfile", writedata);
|
|
||||||
end
|
end
|
||||||
endcase // opcode
|
endcase // opcode
|
||||||
end
|
end
|
||||||
|
|
|
@ -47,7 +47,7 @@ else
|
||||||
-P mips_cpu_harvard_tb.INSTR_INIT_FILE=\"inputs/${INSTR}/${TESTCASE}.txt\" \
|
-P mips_cpu_harvard_tb.INSTR_INIT_FILE=\"inputs/${INSTR}/${TESTCASE}.txt\" \
|
||||||
-P mips_cpu_harvard_tb.DATA_INIT_FILE=\"inputs/${INSTR}/${TESTCASE}.data.txt\" \
|
-P mips_cpu_harvard_tb.DATA_INIT_FILE=\"inputs/${INSTR}/${TESTCASE}.data.txt\" \
|
||||||
-o exec/mips_cpu_harvard_tb_${TESTCASE} testbench/mips_cpu_harvard_tb.v testbench/mips_cpu_memory.v\
|
-o exec/mips_cpu_harvard_tb_${TESTCASE} testbench/mips_cpu_harvard_tb.v testbench/mips_cpu_memory.v\
|
||||||
${SRC} 2> /dev/null
|
${SRC} #2> /dev/null
|
||||||
./exec/mips_cpu_harvard_tb_${TESTCASE} &> ./inputs/${INSTR}/${TESTCASE}.log.txt; # log file for debugging (contains $display)
|
./exec/mips_cpu_harvard_tb_${TESTCASE} &> ./inputs/${INSTR}/${TESTCASE}.log.txt; # log file for debugging (contains $display)
|
||||||
echo "$(tail -1 ./inputs/${INSTR}/${TESTCASE}.log.txt)" > ./inputs/${INSTR}/${TESTCASE}.out.txt; # register v0 output to compare with reference
|
echo "$(tail -1 ./inputs/${INSTR}/${TESTCASE}.log.txt)" > ./inputs/${INSTR}/${TESTCASE}.out.txt; # register v0 output to compare with reference
|
||||||
if diff -w ./inputs/${INSTR}/${TESTCASE}.out.txt ./inputs/${INSTR}/${TESTCASE}.ref.txt &> /dev/null # compare
|
if diff -w ./inputs/${INSTR}/${TESTCASE}.out.txt ./inputs/${INSTR}/${TESTCASE}.ref.txt &> /dev/null # compare
|
||||||
|
|
|
@ -59,14 +59,7 @@ module mips_cpu_harvard_tb;
|
||||||
else $display("TB: CPU did not set active=1 after reset.");
|
else $display("TB: CPU did not set active=1 after reset.");
|
||||||
|
|
||||||
while (active) begin
|
while (active) begin
|
||||||
//$display("Clk: %d", clk);
|
|
||||||
@(posedge clk);
|
@(posedge clk);
|
||||||
//$display("Register v0: %d", register_v0);
|
|
||||||
//$display("Reg File Write data: %d", cpuInst.in_writedata);
|
|
||||||
//$display("Reg File Out Read data: %h", cpuInst.out_readdata1);
|
|
||||||
//$display("Reg File opcode: %b", cpuInst.regfile.opcode);
|
|
||||||
//$display("ALU output: %h", cpuInst.out_ALURes);
|
|
||||||
//$display("ALU input B: %h", cpuInst.alu.B);
|
|
||||||
end
|
end
|
||||||
@(posedge clk);
|
@(posedge clk);
|
||||||
$display("TB: CPU Halt; active=0");
|
$display("TB: CPU Halt; active=0");
|
||||||
|
|
|
@ -56,16 +56,9 @@ module mips_cpu_memory(
|
||||||
|
|
||||||
//Synchronous write path
|
//Synchronous write path
|
||||||
always_ff @(posedge clk) begin
|
always_ff @(posedge clk) begin
|
||||||
//$display("Instruction: %h", instr_readdata);
|
|
||||||
//$display("RAM : INFO : data_read=%h, data_address = %h, mem=%h", data_read, data_address, memory[data_address]);
|
|
||||||
if (data_write) begin //cannot read and write to memory in the same cycle
|
if (data_write) begin //cannot read and write to memory in the same cycle
|
||||||
if (instr_address != data_address) begin //cannot modify the instruction being read
|
if (instr_address != data_address) begin //cannot modify the instruction being read
|
||||||
data_memory[(data_address-32'h00001000)>>2] <= data_writedata;
|
data_memory[(data_address-32'h00001000)>>2] <= data_writedata;
|
||||||
$display("Store in memory");
|
|
||||||
$display(data_writedata);
|
|
||||||
end
|
|
||||||
for (integer k = 0; k<$size(data_memory); k++) begin
|
|
||||||
$display("byte +%h: %h", 32'h00001000+k*4, data_memory[k]);
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue