Professional Documents
Culture Documents
Page 1
Create a new ISE project which will target the FPGA device on the Spartan-3 Startup Kit demo board. To create a new project: 1. Select File => New Project... The New Project Wizard appears. 2. Type lab1 in the Project Name field. 3. Enter or browse to a location (directory path) for the new project. A lab1 subdirectory is created automatically. 4. Verify that HDL is selected from the Top-Level Source Type list. 5. Click Next to move to the device properties page. 6. Fill in the properties in the table as shown below: Product Category: All Family: Spartan3 Device: XC3S200 Package: FT256 Speed Grade: -4 Top-Level Source Type: HDL Synthesis Tool: XST (VHDL/Verilog) Simulator: ISE Simulator (VHDL/Verilog) Preferred Language: Verilog (or VHDL) Verify that Enable Enhanced Design Summary is selected. Leave the default values in the remaining fields. When the table is complete, your project properties will look like the following:
DEPARTMENT OF ELECTRICAL ENGINEERING UNIVERSITY OF GUJRAT
Design Functionality
Page 2
7. Click Next to proceed to the Create New Source window in the New Project Wizard. Atthe end of the next section, your new project will be complete.
Create the top-level Verilog source file for the project as follows: 1. Click New Source in the New Project dialog box. 2. Select Verilog Module as the source type in the New Source dialog box. 3. Type in the file name counter. 4. Verify that the Add to Project checkbox is selected. 5. Click Next. 6. Declare the ports for the counter design by filling in the port information as shown below:
UNIVERSITY OF GUJRAT
Page 3
7. Click Next, then Finish in the New Source Information dialog box to complete the new source file template. 8. Click Next, then Next, then Finish.
UNIVERSITY OF GUJRAT
Page 4
Design Simulation
Create a test bench waveform containing input stimulus you can use to verify the functionality of the counter module. The test bench waveform is a graphical view of a test bench. Create the test bench waveform as follows: 1. Select the fa HDL file in the Sources window. 2. Create a new test bench source by selecting Project New Source. 3. In the New Source Wizard, select Test Bench WaveForm as the source type, and type fa_tbw in the File Name field. 4. Click Next. 5. The Associated Source page shows that you are associating the test bench waveform with the source file counter. Click Next. 6. The Summary page shows that the source will be added to the project, and it displays the source directory, type and name. Click Finish. 7. You need to set the clock frequency, setup time and output delay times in the Initialize Timing dialog box before the test bench waveform editing window opens. Since the first module we are going to verify is combinational, so check Combinational (or internal) option in the Clock information tab on the top right corner
DEPARTMENT OF ELECTRICAL ENGINEERING UNIVERSITY OF GUJRAT
Page 5
8. Click Finish to complete the timing initialization. 9. You will see waveforms for output and input. Apply different possible combinations at the inputs
10. Save the waveform. 11. In the Sources window, select the Behavioral Simulation view to see that the test bench waveform file is automatically added to your project.
UNIVERSITY OF GUJRAT
Page 6
Verify that the counter design functions as you expect by performing behavior simulation as follows: 1. Verify that Behavioral Simulation and fa_tbw are selected in the Sources window. 2. In the Processes tab, click the + to expand the Xilinx ISE Simulator process and doubleclick the Simulate Behavioral Model process. The ISE Simulator opens and runs the simulation to the end of the test bench. 3. To view your simulation results, select the Simulation tab and zoom in on the transitions. The simulation waveform results will look like the following:
Laboratory Rules
4. Verify that the full adder is producing sum and carry as expected. 5. Close the simulation view. If you are prompted with the following message, You have an active simulation open. Are you sure you want to close it?, click Yes to continue. You have now completed simulation of your design using the ISE Simulator. Every system will be used by not more than two students. Students must work on the system allocated to them. And will not be allowed to change their allocated systems Each group must save its projects in a specified folder.
UNIVERSITY OF GUJRAT
Page 7
Assignments
In the next class, you are required to submit verilog code and test bench waveforms for the following circuits i. 4 x 1 Multiplexer ii. 4-bit Carry Look Ahead Adder
UNIVERSITY OF GUJRAT
Page 1
In the first example you have to encode the following circuit of Four Bit Adder subtracter in verilog.
Where as
In the second example you have to encode the following circuit in verilog. After that you have to apply a stimulus covering all possible combinations inputs Draw a truth table from the simulation results. Analyze the truth table and give your comments about the functionality of the circuit.
Page 2
1. Verilog coding of your experiment circuit. 2. Present simulation waveforms. 3. Review of the results to form a truth table to indicate that for each entry the logic simulator give the right results. Feel free to label the waveforms to indicate the proper operation. 1. 2. 3. 4. 5. 6. Name of the project must include your roll no. Code should be well documented. Indentation should be proper. Simulation waveforms should be clear showing all the results. Any plagiarism if found, will cause considerable reduction in grades. No submission will be accepted after the deadline.
Submission Rules
UNIVERSITY OF GUJRAT
Page 1
In the first example you have to encode the following circuit of Four Bit Adder subtracter in verilog.
8x3 Encoder
3x8 Decoder
UNIVERSITY OF GUJRAT
Page 2
Submission Rules
1. 2. 3. 4. 5. 6.
UNIVERSITY OF GUJRAT
Page 1
In this programming exercise, we want to display each hexadecimal digit (0,1,....9,A,b,C,d,E,F) on the 7-segment display.
D0 D1 D2 D3
a b c d ef
e f g d
b c
So in order to display, for example, the hexadecimal digit A (10 in decimal), the LEDs with labels a, b, c, e, f, g should be ON, and the other LED with label d should be OFF. This means that the corresponding pins of the converter should have logic-0. Since we can represent each hexadecimal digit by means of 4 bits, well implement a 47 decoder.
In this programming exercise, we are going to implement a simple 4 bit register. This four bit register should be implemented by instantiating a D flipflop 4 times. Clock should be positive edge triggered and reset should be negative edge triggered.
UNIVERSITY OF GUJRAT
Page 2
4- bit Register
dout
Submission Rules
1. 2. 3. 4. 5. 6.
UNIVERSITY OF GUJRAT