Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Electrical & Electronics Expert

The objective of this lab is to practice your Verilog coding and the modeling of combinational logic.

Lab Goal:

For this lab, you will write the Verilog code for a 4-bit arithmetic/logic unit (ALU) according to the specifications outlined under the specifications section of this document. You will write a TestBench to thoroughly test your design and you will program the BASYS3 board in order to implement your design.

Design Specifications for the ALU

The VERILOG model you implement should be for a 4-bit arithmetic/logic unit (ALU) which has as inputs two 4-bit vectors aluin_a and aluin_b as well as a carry in, Cin. The output is a 4-bit vector alu_out. The ALU should operate on the inputs depending on the control inputs C in the following table:

C(3 down to 0)

Operation

0 0 0 0

alu_out = aluin_a + aluin_b

0 0 0 1

alu_out = aluin_a + aluin_b + Cin

0 0 1 0

alu_out = aluin_a - aluin_b

0 0 1 1

alu_out = aluin_a - aluin_b - Cin

0 1 0 0

alu_out = aluin_a logical shifted right by aluin_b

0 1 0 1

alu_out = aluin_a arithmetic shifted right by aluin_b

0 1 1 0

alu_out = aluin_a rotated right by aluin_b

0 1 1 1

alu_out = all 0's

1 0 0 0

alu_out = aluin_a OR aluin_b (bitwise or)

1 0 0 1

alu_out = aluin_a AND aluin_b (bitwise and)

1 0 1 0

alu_out = aluin_a XOR aluin_b (bitwise xor)

1 0 1 1

alu_out = NOT aluin_a (bitwise inversion)

 

1 1 0 0

alu_out = undefined. But in this mode, all 16 LEDs should be used to display the 1st and 2nd character of your last name (again)

1 1 0 1

alu_out = You decide and tell me what you chose to implement

1 1 1 0

alu_out = aluin_a logical shifted left by aluin_b

1 1 1 1

alu_out = aluin_a rotated left by aluin_b

Other Design Requirements

1. If a carry out is generated, then a signal Cout should be set.

2. If the result is all 0's, then a signal zero should be set.

3. The test bench should test every operation as well as the Cout and Cin for correct operation. Meaning that the test bench should give the inputs such that you can verify all the test cases.

Signal to BASYS3 Hardware Mapping

The signals you use should map to the following BASYS3 I/Os as per the following table:

aluin_a[3:0]

SW3, SW2, SW1, SW0

aluin_b[3:0]

SW7, SW6, SW5, SW4

C[3:0]

SW15, SW14, SW13, SW12

Cin

BTNC

alu_out[3:0]

LD3, LD2, LD1, LD0

Cout

LD14

zero

LD15

Special Case when C=1100, First two characters of your

last name in ASCII.

All 16 LEDs like in Lab 1

Design Suggestions

1. Your design should have a top-level module which is the ALU.

2. Inside the top-level, you should instantiate a 4-bit adder which in turn instantiates 1-bit adder modules. Inputs to the 4-bit adder module can be multiplexed (using, for example, a CASE statement) to do shifting, rotation, logic operations. etc.)

3. 4-bit subtraction can be implemented by taking the 2's compliment of aluin_b prior to presenting it as an input to the adder module.

Submission of Completed Lab:
Upon completing this lab, you must upload to blackboard the following files:
ALU.v ← The file containing the ALU module and any additional modules you have instantiated into it. ALU_tb.v ← The file containing your testbench file
ALU.bit ← The bitstream file for programming the BASYS3 board. A report document uploaded as a .pdf file showing

1. Example waveforms (a screen capture) containing aluin_a, aluin_b, C, Cin, Cout, alu_out and zero when tested by your testbench for any one of the C conditions in Table 1 (except C=1100). Make sure the signals are clear and the signal values are legible. Put in figure captions explaining what the figure shows.

2. An explanation of what you chose to implement when input C is 1101

3. Your argument and code examples as to why you believe your testbench exhaustively tests your design.

Electrical & Electronics, Engineering

  • Category:- Electrical & Electronics
  • Reference No.:- M92855496
  • Price:- $60

Priced at Now at $60, Verified Solution

Have any Question?


Related Questions in Electrical & Electronics

1 goalin this project you will solve a non-trivial design

1 Goal In this project you will solve a non-trivial design problem explicitly using the divide-and-conquer (D&C) approach. The main reason for using the D&C approach is the ease of the design process and the streamlined ...

Case studythis assignment consists of a written report of

CASE STUDY This assignment consists of a written report of approximately 1000 words and any diagrams in which you are asked to critically compare different process methods used to achieve the same result and show an awar ...

Electrical engineering questions -q1 two ideal voltage

Electrical Engineering Questions - Q1. Two ideal voltage sources designated as machines 1 and 2 are connected, as shown in the figure below. Given E 1 = 65∠0 o V, E 2 = 65∠30 o V, Z = 3Ω. Determine if Machine 1 is genera ...

Nanotechnology engineering - resonance circuits questions

Nanotechnology Engineering - Resonance Circuits Questions - Q1) A series RLC network has R = 2KΩ, L = 40mH and C = 1μF. Calculate the impedance at resonance and at one-fourth, one-half, twice, and four times the resonant ...

1 a name the three major groups of contamination and

1. (a) Name the three major groups of contamination and briefly describe their physical characteristics. (b) Where do the above contamination types come from? Give one example of each. 2. Name two processes metrics which ...

Nanotechnology engineering program assignment - passive

Nanotechnology Engineering Program Assignment - Passive Filters Q1) Determine what type of filter is in circuit shown. Calculate the cutoff frequency f c . Q2) Determine what type of filter is in circuit shown. Calculate ...

Question 1for the ce amplifier in figure 1 given the

Question 1 For the CE amplifier in Figure (1), given the following component parameters: Parameter Value β DC , β AC 150 V BE 0 . 7 V V CC 12 V R C 820 ? R E 1 100 ? R E 2 220 ? R 1 20 k? R 2 5 . 2 k? R L 100 k? C 1 , C ...

Question -i a star-connected three-phase synchronous

Question - (i) A star-connected, three-phase synchronous induction motor takes a current of 10 amps from a 415 volt supply at unity power factor when supplying a steady load. If the synchronous reactance is 5 ohms/phase ...

Problem 1given a sequence xn for 0lenle3 where x0 1 x1 1

Problem # 1: Given a sequence x(n) for 0≤n≤3, where x(0) = 1, x(1) = 1, x(2) = -1, and x(3) = 0, compute its DFT X(k). (Use DFT formula, don't use MATLAB function) Problem # 2: Use inverse DFT and apply it on the Fourier ...

Question 1 a pnp transistor withnbspbeta 60 is connected

Question 1. A pnp transistor with β = 60 is connected in a common-base configuration as shown in figure P5.8 (a) The emitter is driven by a constant-current source with I E = 0.75 mA. Determine I B , I C , α, and V C . ( ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As