Write a testbench to thoroughly test your design

Assignment Help Electrical Engineering
Reference no: EM132017848

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.

Verified Expert

This assignment is about coding Verilog design for ALU. ALU- Arithmetic Logic Unit where design of 16 different operations. * As per client request I have wrote Verilog code i.e., for designing and testbench for passing value to the inputs and 2 other files for linking with library files. * This code I have tested in Modelsim tool and took snapshot of it and send it client. * Majorly the development this coding is to implement different operations in the same module. *One typical operation in the set operations is to specify ASCII value to the “alu_out” was the toughest task implement with lots of referenced finally debugged the issue as per client request.

Reference no: EM132017848

Questions Cloud

What is total amount of interest paid over life of loan : Construct a loan amortization schedule for a 15 year, 7.75% loan of $10,000,000. What is the total amount of interest paid over the life of the loan?
Find npv of the project if shadow price of capital is given : A new regulatory policy will have an immediate cost of $75 million, and will create costs of $15 million at the end of each of the next two years.
Calculate the maximum free space loss experienced : Calculate the maximum free space loss experienced by the signals sent from sensors. (Assume control centre is located exactly at the centre of the landscape)
What is the system worth installing : Newsy Inc. will generate $30,000 per year for the next five years from a new database system. The system requires an investment of 120,000 today.
Write a testbench to thoroughly test your design : write a TestBench to thoroughly test your design and you will program the BASYS3 board in order to implement your design
What is the profitability index of the transmission : A new transmission in your truck will cost $5,000.00. Luckily, it should reduce maintenance expense by $3,725.00 each year for the next 10 years.
What will the value of the firm be : New Schools expects an EBIT of $87,000 every year forever. The firm currently has no debt, and its cost of equity is 14.6 percent. The firm can borrow at 7.4.
Find what is the expected return of the portfolio : If the return on the market portfolio is 9% and the 90-day T-Bills are selling at 2% (the risk-free rate); is the expected return of the portfolio aligned.
What would cost of equity be if debt–equity ratio were zero : What would the cost of equity be if the debt–equity ratio were zero?

Reviews

inf2017848

8/6/2018 2:52:21 AM

I thank you so much, I have only one thing. The module alu_pt. Am I just changing the alu coding? If so, you modeled it a little different than it showed so I just need to know where to put the changes. -yes u can makes changes -if u want to make any changes according logic then u have make changes in "alu". -if u want to change in alu_in1 and alu_in2 and other input signals u have pass values in "alu_tb" -other 2 files are to run in the simulator -now it depends on u whether to u need to change logic or values passed to inputs and makes changes according to it.

inf2017848

8/6/2018 2:51:06 AM

I’m using Modelsim and Quartus All I’m asking for is the coding I can run it myself flist is the file where dut and tb are internally connected --Makefile includes library file and execution file. --i have run this codes in Modelsim and attached screenshot of it. -- If your are running in Modelsim just type "make mpsim" im command line interface. In that assignment they ask special ascii value to implement : For that I have implemented value 'z'( if u want u may change ascii value) --ASCII value of 'z' is "01111010" If u check in the waveforms we all see only LSB 4bits i.e., 1010 because in our module we declared 4bits only. While ur running up code the may vary according to machine u may get the output "0111" or "1010" because machine may have integrated with big endian or little endian...My machine integrated with little endian so I have got LSB 4bits.

len2017848

6/13/2018 5:43:28 AM

GRADING 60% of the grade will be based on whether your ALU.bit file works when downloaded to a BASYS3 board. 40% of the grade will be based on your report Can't seem to grasp the concept

Write a Review

Electrical Engineering Questions & Answers

  Calculate the phase voltage and line voltage

A three 120 - V power line is Y-connected. The three phase outputs are marked as a,b,c. The neutral is marked as n. The phase sequence is abc. It is connected to a balanced Y- connected load, with the impedance is 12 + j 9 omega.

  Eliminate the filter output delay place two zeros at origin

Design a second-order band-pass IIR filter with center frequency of 200 Hz when the sampling frequency is 1000 Hz. In order to ensure the filter stability set the poles at 0.94 radial distant from the origin

  How to use a mealy model with minimum number of states

Draw a state diagram for a synchronous sequence detector that will detect every occurence of the sequence 111001 in a serially transmitted message of any length. The sequence detector should detect overlapping sequences as well as individual occur..

  Problem based on flow control system.

Problem based on flow control system. The control objective is to maintain a constant flow rate, Q0, for varying values of input flow rate, Q2.

  Pressure forces are independent of direction

Assume that with respect to one set of axes Σ is diagonal but that not all three diagonal elements are equal. (For example, σ11≠σ33.) It is not hard to come up with a rotation - that of Equation (15.36) will do - such that in the rotated system σ'..

  How many outcomes are in the event that the person is born

Find out the birthday (month and day but not year) of a randomly chosen person. What is the sample space of the experiment. How many outcomes are in the event that the person is born in July

  Find the sop and pos solutions for the given function

Using the Quine-McCluskey's method, find the SOP and POS solutions for the function below, and verify that they match with the Karnaugh map solutions. f (a,b, c, d) = \(\sum m(0,1,6,15)+ \sum d(3,5,7,11,14)\)

  Determine the trans-conductance of such a device

where vsat is a relatively constant velocity. Determine the trans-conductance of such a device.

  Write the nodal equations for the networks of given figure

Write the nodal equations for the networks of given figure. -Solve for the nodal voltages. - Find the magnitude and polarity of the voltage across each resistor.

  Design the sailboat to your own specifications

Design the sailboat to your own specifications using the techniques discussed in this chapter.

  Determine position of current max nearest the load

A 50 (ohm) lossless transmission line is terminated in a load with impedance Z= (30-j50) ohm. the wavelength is 8cm. Determine: (a) reflection coefficient (solved: 0.1 - j0.56 or 0.56 angle -79.9)

  Find the voltage and power gain of the amplifier

An amplifier has an open-circuit voltage gain of 1500, an input impedance of 3 kΩ, and an output impedance of 300 Ω. Find the voltage and power gain of the amplifier in decibels when a load impedance of 200 Ω is connected to the output of the ampl..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd