Question
I am writing a ALU with register reading and writing. I have already done all parts except the certain wire that what to set writedata
I am writing a ALU with register reading and writing. I have already done all parts except the certain wire that what to set writedata again as the ALUresut and save into one certain register.
Thank you for help.
module lab3B(RegWrite, clock, Read1, Read2, WriteReg, WriteData,
OpcodeField, ALUOp, Zero, ALUResult);
input [4:0] Read1;
input [4:0] Read2;
input [4:0] WriteReg;
input [63:0] WriteData;
input RegWrite;
input clock;
input [10:0] OpcodeField;
input [1:0] ALUOp;
wire [63:0] A;
wire [63:0] B;
wire [63:0] ALUResult;
output Zero;
lab3A RegisterFile(Read1, Read2, WriteReg, WriteData, RegWrite, clock, A, B);
lab2C ALUFile (ALUOp, OpcodeField, A, B, ALUResult, Zero);
endmodule
module lab3A(Read1,
Read2,
WriteReg,
WriteData,
RegWrite,
clock,
A,
B
);
input [4:0] Read1;
input [4:0] Read2;
input [4:0] WriteReg;
input [63:0] WriteData;
input RegWrite;
input clock;
output [63:0] A;
output [63:0] B;
reg [63:0] RF[0:31];//
assign A = RF[Read1];
assign B = RF[Read2];
always@(posedge clock) begin
if(RegWrite) RF[WriteReg]
end
endmodule
module lab2C(ALUOp, OpcodeField, A, B, ALUResult, Zero);
input [1:0] ALUOp;
input [10:0] OpcodeField;
input [63:0] A;
input [63:0] B;
output [63:0] ALUResult;
output Zero;
wire [3:0] ALUOperation;
lab2B ALUControl(ALUOp,OpcodeField,ALUOperation);
lab2A ALU(ALUOperation,A,B,ALUResult,Zero);
endmodule
w WPS f. Lab3A B C RF + ALU (3).docx *-WPS WPS 2019 , 1 2 3 F , *TA , , , WwPS Lab3 A B C R , ALU (3).docx + , a> x x We want to extend Lab 3B to support R Type instructions or ALU instructions. RType instructions are of the form ADD X1, X2, X3. This means Register X2 and Register X3 must be added and the result must be written in Register X1. In Lab 3B we obtained the results of some ALU operations but they were not written back to the Register File. We have to close the loop. We have to take the ALU results and put them in the Register File. The book shows this operation by a feedback path in say, Fig.4.1 where the ALU result is taken back to Register File by a path on the top and gets into Register File as Data path in say.Fig:41 where the resuts and put them in the RegseeEl Read register 1 Read datal 64 Read Register 2 61 64 Read Data2 Write register (Address) ALUOp Write Data 64 Opcode tield ALU operation Re^Wrile clock Jo, : 3 luk: 3/5 : 1 /1 : 6./|87 |: 1 178 WH 100 %- LE 2018/9/17 w WPS f. Lab3A B C RF + ALU (3).docx *-WPS WPS 2019 , 1 2 3 F , *TA , , , WwPS Lab3 A B C R , ALU (3).docx + , a> x x We want to extend Lab 3B to support R Type instructions or ALU instructions. RType instructions are of the form ADD X1, X2, X3. This means Register X2 and Register X3 must be added and the result must be written in Register X1. In Lab 3B we obtained the results of some ALU operations but they were not written back to the Register File. We have to close the loop. We have to take the ALU results and put them in the Register File. The book shows this operation by a feedback path in say, Fig.4.1 where the ALU result is taken back to Register File by a path on the top and gets into Register File as Data path in say.Fig:41 where the resuts and put them in the RegseeEl Read register 1 Read datal 64 Read Register 2 61 64 Read Data2 Write register (Address) ALUOp Write Data 64 Opcode tield ALU operation Re^Wrile clock Jo, : 3 luk: 3/5 : 1 /1 : 6./|87 |: 1 178 WH 100 %- LE 2018/9/17
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started