Question: hw 7 elearning file Alu.sv module ALU ( Result , N , Z , C , V , A , B , ALUcontrol ) ;
hw elearning file
Alu.sv
module ALUResult NZCVAB ALUcontrol;
input : AB;
input : ALUcontrol;
output : Result;
output NZCV;
wire : Rmuxout,sum;
wire : cout;
Instantiating one bit adder
RippleAdderb RbsumsumcoutcoutaAbmuxoutcinALUcontrol;
: mux to select B or not B
assign muxout ALUcontrol ~B : B;
: mux to select ALU outputs
assign R ALUcontrol AB : A&B;
assign Result ALUcontrol R : sum;
Status outputs
assign N Result;
assign Z ~Result;
assign C ALUcontrol & cout;
assign V ALUcontrol & cout cout;
endmodule
module RippleAdderbsumcout,abcin;
input : ab;
input cin;
output : sum;
output : cout;
Instantiating bit full adders
fulladder FAsumsumcoutcoutaabbcincin;
fulladder FAsumsumcoutcoutaabbcincout;
fulladder FAsumsumcoutcoutaabbcincout;
fulladder FAsumsumcoutcoutaabbcincout;
fulladder FAsumsumcoutcoutaabbcincout;
fulladder FAsumsumcoutcoutaabbcincout;
fulladder FAsumsumcoutcoutaabbcincout;
fulladder FAsumsumcoutcoutaabbcincout;
endmodule
module fulladder sum cout, a b cin;
input a b cin;
output sum, cout;
wire w w w;
Instantiating bit half adders to make bit full adder
halfadder haw w a b;
halfadder hasum w w cin;
assign cout w w;
endmodule
module halfadders c a b;
output s c;
input a b;
sum is a XOR b and carry is a AND b
assign s a b;
assign c a & b;
endmodule
Dmemexpected.tv
memories.sv
x bit memory module with one read and one write port
module dmemclk we addr, wrdata, rddata;
input clk;
input we; writeenable
input : addr; address
input : wrdata; write port
output : rddata; read port
reg : RAM:; Memory Array
assign rddata RAMaddr; Read from address addr
always @posedge clk begin
if we
RAMaddr wrdata; Write to address addr the value
end on the write data port when we
Initialize the memory module
initial begin
RAMh;
RAMh;
end
endmodule
module imemaddrrddata;
input : addr; address
output : rddata; read port
reg : RAM:; Memory Array
assign rddata RAMaddr; Read from address addr
Initialize the memory module
initial begin
RAMb; LD R DMem
RAMb; LD R DMem
RAMb; ADD R R R
RAMb; ADD R R R
RAMb; ADD R R R
RAMb; ST R DMem
RAMb; ST R DMem
RAMb; ST R DMem
RAMb; LD R DMem
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
