Chapter 1: Q21E (page 2)
Question:B.21 [10] <§§B.3, B.4> Given the following logic diagram for an accumulator, write down the Verilog module implementation of it. Assume a positive edgetriggered register and asynchronous Rst.
Short Answer
Answer
The required Verilog module implementation:
module_verilog_accumulator(QIn, L0, Clock, RESET, L1, Qout);
input[15:0] L0, QIn;
inputClock, RESET, L1;
Qoutput[15:0] Qout t;
reg[15:0] Qout;
always@(posedge RESET or posedge Clock) begin
if(RESET) Qout <=0;
elseif (L1)
Qout<=L0;
else
Qout<= Qout + QIn;
end
End_module_verilog_accumulator