Question

The Arithmetic Logic Unit The first topic for the project is to create an Arithmetic Logic...

The Arithmetic Logic Unit

The first topic for the project is to create an Arithmetic Logic Unit, using a structured approached with a Virtual Hardware Design Language such as Verilog. Mainly, the program is very close to a simulator for a programming calculator.

An ALU typically has the following operations

Math Functions: Add, Subtract, Multiply, Divide, Modulus

Logic Functions: And, Or, XOR, Not, Nand, Nor, XNOR

Error Modes: Divide by Zero, Overflow

Support Functions: No Operation, Shift Left, Shift Right, Reset

And has the following additional abilities

To store the first input

To store the second input

To store the results of the operation

And to use the results of the operation to be one of the inputs.

Addition, subtraction, multiplication for basic math are typical. Long division and modulus for more of a challenge. In addition, an ALU can shift a binary value left or right, with or without a ring behavior. And ALU can have an error state on an overflow or a divide by zero error. And that means an ALU would also have a reset or clear command. And importantly, an ALU can be at rest, with a “no-operation.” The data can be integer, or may include floating point, and can use various methods of sign. It is recommended that an ALU should operate on at least 16-bit integers. And that means the result of an operations should have room for at least 32 bits. That being said, the ALU should have at least ten “modes”, that is operations, and error states, and supporting functions.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

ALU refers to Arithmetic and logical unit which is used to perform the operation of mathematical and logical such as addition,substraction,multilpication,division,modulus division ,AND,OR,XOR and XNOR etc.

Program:

module alu(

input [ 7:0] A,B,

input [3:0] ALU_Sel,

output [7:0] ALU_Out,

output CarryOut

);

reg [7:0] ALU_Result;

wire [8:0] tmp;

assign ALU_Out = ALU_Result;

assign tmp = {1'b0,A} + {1'b0,B};

assign_CarryOut = tmp[8];

always @(*)

begin

case(ALU_Sel)

4'b0000:

ALU_Result = A + B;

4'b0001:

ALU_Result = A - B;

4'b0010:

ALU_Result = A * B;

4'b0011:

ALU_Result = A/B;

4'b0100:

ALU_Result = A<<1;

4'b0101:

ALU_Result = A>>1;

4'b0110:

ALU_Result ={ A[6:0],A[7]};

4'b0111:

ALU_Result ={ A[0],A[7:1]};

4'b1000:

ALU_Result = A & B;

4'b1001:

ALU_Result = A | B;

4'b1010:

ALU_Result = A ^ B;

4'b1011:

ALU_Result = ~(A | B);

4'b1100:

ALU_Result = ~(A & B);

4'b1101:

ALU_Result = ~(A ^ B);

4'b1110:

ALU_Result = ~(A > B)?8'd1:8'd0;

4'b1111:

ALU_Result = (A == B)?8'd1:8'd0;

default: ALU_Result = A + B;

endcase

end

endmodule

Add a comment
Know the answer?
Add Answer to:
The Arithmetic Logic Unit The first topic for the project is to create an Arithmetic Logic...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Derive the logic gates for a 2-bit Arithmetic Logic Unit (ALU) with four micro-operations: 1) Complete...

    Derive the logic gates for a 2-bit Arithmetic Logic Unit (ALU) with four micro-operations: 1) Complete the table below by showing the select input bits and the necessary groupings. (5 points) Select Inputs Micro-Operation Description F = A-B-1 F = A + B +1 F = AVB F = ashl A Subtraction with borrow Addition with carry Logic OR Arithmetic shift left 2) Draw a detailed logic circuit of the ALU's arithmetic unit. (10 points) 3) Draw a detailed logic...

  • Using Structural Modeling in VHDL write the code for: An Arithmetic Logic Unit (ALU) shown in...

    Using Structural Modeling in VHDL write the code for: An Arithmetic Logic Unit (ALU) shown in the figure below. A (16-bit), B (16-bit), Opcode (3-bit), and Mode (1-bit) are the inputs; and ALUOut (16-bit) and Cout (1-bit) are the outputs of the design. A and B hold the values of the operands. Mode and Opcode together indicate the type of the operation performed by ALU. The ALU components ARE: -Arithmetic Unit that consists of one 16-bit adder, 16-bit subtractor, 16-bit...

  • This section gives you freedom to come up with your own solutions. An Arithmetic and Logic Unit (...

    This section gives you freedom to come up with your own solutions. An Arithmetic and Logic Unit (ALU) is a combinational circuit that performs logic and arithmetic micro-operations on a pair of 4-bit operands. The operations performed by an ALU are controlled by a set of function-select inputs. In this lab you will design a 4-bit ALU with 3 function-select inputs: Mode M, Select S1 and S0 inputs. The mode input M selects between a Logic (M=0) and Arithmetic (M=1)...

  • Implement an arithmetic logic unit (ALU) using Verilog. Consider signed number arithmetic operation. The outputs of...

    Implement an arithmetic logic unit (ALU) using Verilog. Consider signed number arithmetic operation. The outputs of the ALU should be 1) Addition of two 8-bit numbers 2) A Zero Flag. It is set (it is 1 if the condition is met and 0 otherwise) if the result is zero. 3) A Negative Flag. It is set (it is 1 if the condition is met and 0 otherwise) if the result is less than 0. 4) An Overflow Flag. It is...

  • FIRST ACTIVITY: (100/100) . SIMPLE 4-BIT ARITHMETIC LOGIC UNIT (ALU): This circuit selects between arithmetic (absolute...

    FIRST ACTIVITY: (100/100) . SIMPLE 4-BIT ARITHMETIC LOGIC UNIT (ALU): This circuit selects between arithmetic (absolute value, addition) and logical (XOR, AND) operations. Only one result (hexadecimal value) can be shown on the 7-segment display This is selected by the input sel (1..0) B A-BI A+B A xnor B A nand B Input EN: If EN-1result appears on the 7 segment display. If EN=0 → all LEDs in the 7 segment display are off Arithmetic operations: The 4-bit inputs A...

  • Datapath To make the calculator work, you have to create datapath components for the Datapath subcircuit:...

    Datapath To make the calculator work, you have to create datapath components for the Datapath subcircuit: Create an ALU that can calculate the result for the basic arithmetic operations (addition, subtraction, multiplication, division) for two 8-bit values. The ALU should output the needed result depending on the selected operation. Use 3 registers to store the first number, selected operator and second number. Remember that registers store the values on the input during a rising edge in the clock input (default...

  • Q2. Design a 8-bit ALU (Arithmetic Logic Unit) supporting the following instructions, Z and C values...

    Q2. Design a 8-bit ALU (Arithmetic Logic Unit) supporting the following instructions, Z and C values should be re-evaluated (updated) ifY changes Instruction type code[2:0] operations Logical Status update 001 010 011 100 101 110 ( Bitwise AND) Y = A & B: | Z (C is always 0) (bitwise OR) Y- A B; (bitwise XOR) Y-A B Z (Cis always 0) (negation) Y =-A; (Addition) Y A + B: (subtraction) Y = A-B: (Increment) Y-A+1 (decrement) Y-A-1 Z (C...

  • You will use Quartus II to build an 8 bit arithmetic logic unit that performs the...

    You will use Quartus II to build an 8 bit arithmetic logic unit that performs the following functions: Control Value Function                                000 Copy In1 to theResult unchanged 001 Copy In2 to theResult unchanged 010 Add In1 to In2 011 Subtract In2 from In1 100 And In1 and In2 101 Or In1 and In2 110 Shift left In1 by 1 bit 111 Shift right In1 by 1 bit You are allowed to use either gates/logic schematic, or else Verilog. We suggest...

  • PROBLEM STATEMENT The mini-calculator will use a small ALU to perform arithmetic operations on two 4-bit values which are set using switches. The ALU operations described below are implemented with a...

    PROBLEM STATEMENT The mini-calculator will use a small ALU to perform arithmetic operations on two 4-bit values which are set using switches. The ALU operations described below are implemented with an Adder/Subtractor component. A pushbutton input allows the current arithmetic result to be saved. An upgraded mini-calculator allows the saved value to be used in place of B as one of the operands. The small ALU that you will design will use the 4-bit adder myadder4 to do several possible...

  • Do not use pointer variables, pointer arithmetic or operater new ITCS-2530    Project                        Write an...

    Do not use pointer variables, pointer arithmetic or operater new ITCS-2530    Project                        Write an interactive program that performs fractional calculations. You need define a class CFrac for a fractional number according to the UML diagram below: CFrac - numerator : int - denominator : int - simplify () : void + CFrac (int = 0, int = 1) + ~CFrac() + add (const CFrac&) const : CFrac + subtract (const CFrac&) const : CFrac + multiply (const CFrac&)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT