Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the ALU below module alu(inp1, inp2, sel, out); input[3:0] inp1, inp2, sel; output[3:0] out; reg[3:0] out; always @(inp1, inp2, sel) begin case(sel) 4'b0000: begin

Using the ALU below

module alu(inp1, inp2, sel, out); input[3:0] inp1, inp2, sel; output[3:0] out; reg[3:0] out;

always @(inp1, inp2, sel) begin case(sel) 4'b0000: begin out = inp1 + inp2; end // Addition 4'b0001: begin out = inp1 - inp2; end // Subtraction 4'b0010: begin out = inp1 - 1; end // Subtract by 1 4'b0011: begin out = inp1 + 1; end // Add by 1 4'b0100: begin out = inp1 & inp2; end // Logical AND 4'b0101: begin out = inp1 | inp2; end // Logical OR 4'b0110: begin out = ~ inp1; end // LOGICAL NOT 4'b0111: begin out = (inp1 ^ inp2); end // XOR 4'b1000: begin out = inp1 << 4'b0010; end // Logical shift Left 4'b1001: begin out = inp2 >> 4'b0011; end // Logical shift Right default: begin out = 4'b0000; end // This line is very important endcase end endmodule

  • Modify the ALU generate a sum and a carry.

  • Modify the ALU to add an input carry and generate a sum and a carry

  • Modify the ALU to implement subtraction using twos complement

  • Modify the ALU to compare two 4-bit inputs

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

Objects And Databases International Symposium Sophia Antipolis France June 13 2000 Revised Papers Lncs 1944

Authors: Klaus R. Dittrich ,Giovanna Guerrini ,Isabella Merlo ,Marta Oliva ,M. Elena Rodriguez

2001st Edition

3540416641, 978-3540416647

More Books

Students also viewed these Databases questions