mirror of
https://github.com/supleed2/ELEC50010-IAC-CW.git
synced 2024-11-10 01:35:49 +00:00
Fix syntax errors from mult/div
This commit is contained in:
parent
07d32e9baf
commit
4ff160db1a
|
@ -99,7 +99,7 @@ initial begin
|
||||||
Lo <= 32'd0;
|
Lo <= 32'd0;
|
||||||
end
|
end
|
||||||
|
|
||||||
always_comb begin
|
always @(*) begin
|
||||||
assign ALUOps = ALUOp;
|
assign ALUOps = ALUOp;
|
||||||
case(ALUOps)
|
case(ALUOps)
|
||||||
ADD: begin
|
ADD: begin
|
||||||
|
@ -216,11 +216,11 @@ end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
/*
|
||||||
PAS: begin
|
PAS: begin
|
||||||
ALURes = A;
|
ALURes = A;
|
||||||
end
|
end
|
||||||
|
*/
|
||||||
SLT: begin
|
SLT: begin
|
||||||
if ($signed(A) < $signed(B)) begin
|
if ($signed(A) < $signed(B)) begin
|
||||||
ALURes = 1;
|
ALURes = 1;
|
||||||
|
|
|
@ -120,9 +120,9 @@ always @(*) begin
|
||||||
$display("Memory read disabled");
|
$display("Memory read disabled");
|
||||||
end else if ((op==JAL) || ((op==SPECIAL)&&(funct == JALR)))begin
|
end else if ((op==JAL) || ((op==SPECIAL)&&(funct == JALR)))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 == MTHI)))begin
|
end else if ((op==SPECIAL)&&(funct == MTHI))begin
|
||||||
CtrlMemtoReg = 3'd3;//write data port of regfile is fed from ALUHi
|
CtrlMemtoReg = 3'd3;//write data port of regfile is fed from ALUHi
|
||||||
end else if ((op==SPECIAL)&&(funct == MTLO)))begin
|
end else if ((op==SPECIAL)&&(funct == MTLO))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
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,10 @@ assign data_write = out_MemWrite;
|
||||||
assign data_read = out_MemRead;
|
assign data_read = out_MemRead;
|
||||||
assign data_writedata = out_readdata2;
|
assign data_writedata = out_readdata2;
|
||||||
|
|
||||||
logic[31:0] out_pc_out, out_ALURes, out_readdata1, out_readdata2, in_B, in_writedata;
|
logic[31:0] out_pc_out, out_ALURes, out_readdata1, out_readdata2, in_B, in_writedata, out_ALUHi, out_ALULo;
|
||||||
logic[4:0] in_readreg1, in_readreg2, in_writereg, out_shamt, out_ALUOp;
|
logic[4:0] in_readreg1, in_readreg2, in_writereg, out_shamt, out_ALUOp;
|
||||||
logic[5:0] in_opcode;
|
logic[5:0] in_opcode;
|
||||||
logic out_ALUCond, out_RegWrite, out_ALUSrc, out_MemWrite, out_MemRead;
|
logic out_ALUCond, out_RegWrite, out_ALUSrc, out_MemWrite, out_MemRead, out_SpcRegWriteEn;
|
||||||
logic[1:0] out_RegDst, out_PC;
|
logic[1:0] out_RegDst, out_PC;
|
||||||
logic[2:0] out_MemtoReg;
|
logic[2:0] out_MemtoReg;
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ mips_cpu_alu alu(
|
||||||
.ALUCond(out_ALUCond), //condition used by control to decide on branch instructions.
|
.ALUCond(out_ALUCond), //condition used by control to decide on branch instructions.
|
||||||
.ALURes(out_ALURes), //output/result of operation that goes to either: 'Address' port of Data Memory; or 'Write Data' port of the register file.
|
.ALURes(out_ALURes), //output/result of operation that goes to either: 'Address' port of Data Memory; or 'Write Data' port of the register file.
|
||||||
.ALUHi(out_ALUHi), //Special register Hi output to be used for MFHI instructions - feeds in_writedata.
|
.ALUHi(out_ALUHi), //Special register Hi output to be used for MFHI instructions - feeds in_writedata.
|
||||||
.ALULo(out_ALULo), //Special register Hi output to be used for MFLO instructions - feeds in_writedata.
|
.ALULo(out_ALULo) //Special register Hi output to be used for MFLO instructions - feeds in_writedata.
|
||||||
);
|
);
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
|
@ -30,7 +30,7 @@ always_ff @(posedge clk) begin
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
always_comb begin
|
always @(*) begin
|
||||||
case(pc_ctrl)
|
case(pc_ctrl)
|
||||||
2'd1: begin // Branch
|
2'd1: begin // Branch
|
||||||
pc_next = pc_out + 32'd4 + {{14{instr[15]}},instr[15:0],2'b00};
|
pc_next = pc_out + 32'd4 + {{14{instr[15]}},instr[15:0],2'b00};
|
||||||
|
|
Loading…
Reference in a new issue