Lab2 VHDL
Lab2 VHDL
This is an exercise in designing combinational circuits that can perform binary-coded-decimal (BCD) addition and binary-to-decimal number conversion. Part I We wish to display on the 7-segment displays, HEX3 to HEX0, the hexadecimal values set by the switches SW150 . Let the values denoted by SW1512 , SW118 , SW74 and SW30 be displayed on HEX3, HEX2, HEX1 and HEX0, respectively. 1. Create a new project which will be used to implement the desired circuit on the Altera DE2 board. 2. Write a VHDL le that provides the necessary functionality. 3. Include the VHDL le in your project and compile the project. 4. Assign the pins on the FPGA to connect to the switches and 7-segment displays, as indicated in the User Manual for the DE2 board. 5. Recompile the project and download the compiled circuit into the FPGA chip. 6. Test the functionality of your design by toggling the switches and observing the output display. Part II Design a circuit that can add two 2-digit BCD numbers as follows: 1. Use switches SW158 and SW70 to represent 2-digit BCD numbers A and B, respectively. The value of A should be displayed on the 7-segment displays HEX7 and HEX6, while B should be on HEX5 and HEX4. Write VHDL code to specify a circuit that generates C = A + B and displays the sum, C, in the BCD form on the 7-segment displays HEX2, HEX1 and HEX0. 2. Compile the designed circuit and simulate its functional behavior. 3. Make the necessary pin assignments and recompile the circuit. 4. Download the circuit into the FPGA chip. 5. Test your circuit by trying different values for numbers A and B. Part III Design a combinational circuit that converts a 6-bit binary number into a 2-digit decimal number represented in the BCD form. Use switches SW50 to input the binary number and 7-segment displays HEX1 and HEX0 to display the decimal number. Implement your circuit on the DE2 board and demonstrate its functionality.