Implement the following Verilog code using these components: D flip-flops with clock enable, a multiplexer, an adder,

Question:

Implement the following Verilog code using these components: D flip-flops with clock enable, a multiplexer, an adder, and any necessary gates. Assume that Ad and Ora will never be 1 at the same time and enable the flip-flops only when Ad or Ora is 1.
module module1(A,B,Ad,Ora,clk,C);
input Ad,Ora,clk;
input [2:0]A,B;
output reg[2:0]C;
initial
begin
C = 3'd0;
end
always @(posedge clk)
begin
if(Ad == 1'b1)
C <= A + B;
if(Ora == 1'b1)
C <= A | B;
end
endmodule

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Digital Systems Design Using Verilog

ISBN: 978-1285051079

1st edition

Authors: Charles Roth, Lizy K. John, Byeong Kil Lee

Question Posted: