Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The answer is: module Q1 (output reg[7:0] y, input [7:0] A, B, input [2:0] Sel); always @(A, B, Sel) begin y=0; case (Sel) 3'b000: y=8'b0;

The answer is:

module Q1 (output reg[7:0] y, input [7:0] A, B, input [2:0] Sel);

always @(A, B, Sel) begin

y=0;

case (Sel)

3'b000: y=8'b0;

3'b001: y=A&B;

3'b010: y=A|B;

3'b011: y=A^B;

3'b100: y=A+B;

3'b101: y=A-B;

3'b110: y=~A;

3'b111: y=8'hFF;

endcase

end

endmodule

module Q();

wire [7:0]y;

reg [7:0] A,B;

reg [7:0] Sel;

Q1 MO (y, A, B, Sel);

initial#180 $finish;

initial fork

#5 begin A=8'hAA; B=8'h55; end

#10 begin Sel=3'b000; A=8'hAA; B=8'h55; end

#20 begin Sel=3'b001; A=8'hAA; B=8'hAA; end

#30 begin Sel=3'b001; A=8'h55; B=8'h55; end

#40 begin Sel=3'b010; A=8'h55; B=8'h55; end

#50 begin Sel=3'b010; A=8'hAA; B=8'hAA; end

#60 begin Sel=3'b011; A=8'h55; B=8'h55; end

#70 begin Sel=3'b011; A=8'hAA; B=8'h55; end

#80 begin Sel=3'b100; A=8'h55; B=8'h00; end

#90 begin Sel=3'b100; A=8'hAA; B=8'h55; end

#110 begin Sel=3'b101; A=8'hAA; B=8'h55; end

#120 begin Sel=3'b101; A=8'h55; B=8'hAA; end

#130 begin Sel=3'b110; A=8'hFF; end

#140 begin Sel=3'b110; A=8'd0; end

#150 begin Sel=3'b110; A=8'hFF; end

#160 begin Sel=3'b111; end

join

endmodule

But I can not understand what it is doing after module Q()......

Can anyone explain to me? Thanks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

02 Legislative and regulatory processes.

Answered: 1 week ago