Question

In: Electrical Engineering

Overview In this assignment you are required to implement binary code comparator using Xilinx that it...

Overview

In this assignment you are required to implement binary code comparator using Xilinx that it is compatible with the MXK Seven Segment Displays. You will draw your digital logic circuit using Xilinx and then simulate it to verify the functionality of your design.

Software Requirements

? Xilinx ISE 10.1 or higher

Specifications

Binary Code Comparator

The binary code comparator is to be implemented and made compatible with the seven 7-segment displays of the board. Represent the first five digits of your student number into binary. If a given decimal digit is odd, then the binary equivalent will be 1, otherwise it will be 0. For example, the student (decimal) number 99805234 will produce 11001. The user is to enter a 5-bit binary sequence one bit at a time. The five bits will be displayed on five of the seven segment displays. If the five entered bits equal to the stored binary code, then ‘E’ is to be displayed on the sixths seven- segment display. However, if the five entered bits do not equal the binary code, then ‘n’ is to bedisplayed. Note that you do not have to display bits as they are received in accumulating manner (as shown in the figure below), rather, you can display all five bits and the comparator outcome (‘E’ or ‘n’) when the fifth bit is received. All six seven-segment displays are to stay on for five seconds, then they will be erased. Once the displays are erased, the circuit will be ready for receiving a new set of five input bits.

- Reset: if pressed, the circuit will return to the initial state and all seven segment displays are to be erased.

- Input (could be received from a dipswitch in your MXK): to specify the binary input (1 or 0).

- Trigger (could be received from a pushbutton in your MXK): to allow the input to be received by the circuit.

- Clock: to alternate between the 7-segment displays (expected to be around 1000 Hz).

There are two sets of outputs, which are:

- d1, d2, ..., d7 (anodes to switch between the seven 7-segment displays)

Solutions

Expert Solution


library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.std_logic_unsigned.all;
entity seven_segment_display_VHDL is
   Port ( clock_1000hz : in STD_LOGIC;-- 1000hz clock on Basys 3 FPGA board
          reset : in STD_LOGIC; -- reset
          Anode_Activate : out STD_LOGIC_VECTOR (3 downto 0);-- 4 Anode signals
          LED_out : out STD_LOGIC_VECTOR (6 downto 0));-- Cathode patterns of 7-segment display
end seven_segment_display_VHDL;

architecture Behavioral of seven_segment_display_VHDL is
signal one_second_counter: STD_LOGIC_VECTOR (27 downto 0);
-- counter for generating 1-second clock enable
signal one_second_enable: std_logic;
-- one second enable for counting numbers
signal displayed_number: STD_LOGIC_VECTOR (15 downto 0);
-- counting decimal number to be displayed on 4-digit 7-segment display
signal LED_BCD: STD_LOGIC_VECTOR (3 downto 0);
signal refresh_counter: STD_LOGIC_VECTOR (19 downto 0);
-- creating 10.5ms refresh period
signal LED_activating_counter: std_logic_vector(1 downto 0);
-- the other 2-bit for creating 4 LED-activating signals
-- count         0 -> 1 -> 2 -> 3
-- activates    LED1 LED2 LED3   LED4
-- and repeat
begin
-- VHDL code for BCD to 7-segment decoder
-- Cathode patterns of the 7-segment LED display
process(LED_BCD)
begin
   case LED_BCD is
   when "0000" => LED_out <= "0000001"; -- "0"     
   when "0001" => LED_out <= "1001111"; -- "1"
   when "0010" => LED_out <= "0010010"; -- "2"
   when "0011" => LED_out <= "0000110"; -- "3"
   when "0100" => LED_out <= "1001100"; -- "4"
   when "0101" => LED_out <= "0100100"; -- "5"
   when "0110" => LED_out <= "0100000"; -- "6"
   when "0111" => LED_out <= "0001111"; -- "7"
   when "1000" => LED_out <= "0000000"; -- "8"     
   when "1001" => LED_out <= "0000100"; -- "9"
   when "1010" => LED_out <= "0000010"; -- a
   when "1011" => LED_out <= "1100000"; -- b
   when "1100" => LED_out <= "0110001"; -- C
   when "1101" => LED_out <= "1000010"; -- d
   when "1110" => LED_out <= "0110000"; -- E
   when "1111" => LED_out <= "0111000"; -- F
   end case;
end process;
-- 7-segment display controller
-- generate refresh period of 10.5ms
process(clock_1000hz,reset)
begin
   if(reset='1') then
       refresh_counter <= (others => '0');
   elsif(rising_edge(clock_1000hz)) then
       refresh_counter <= refresh_counter + 1;
   end if;
end process;
LED_activating_counter <= refresh_counter(19 downto 18);
-- 4-to-1 MUX to generate anode activating signals for 4 LEDs
process(LED_activating_counter)
begin
   case LED_activating_counter is
   when "00" =>
       Anode_Activate <= "0111";
       -- activate LED1 and Deactivate LED2, LED3, LED4
       LED_BCD <= displayed_number(15 downto 12);
       -- the first hex digit of the 16-bit number
   when "01" =>
       Anode_Activate <= "1011";
       -- activate LED2 and Deactivate LED1, LED3, LED4
       LED_BCD <= displayed_number(11 downto 8);
       -- the second hex digit of the 16-bit number
   when "10" =>
       Anode_Activate <= "1101";
       -- activate LED3 and Deactivate LED2, LED1, LED4
       LED_BCD <= displayed_number(7 downto 4);
       -- the third hex digit of the 16-bit number
   when "11" =>
       Anode_Activate <= "1110";
       -- activate LED4 and Deactivate LED2, LED3, LED1
       LED_BCD <= displayed_number(3 downto 0);
       -- the fourth hex digit of the 16-bit number    
   end case;
end process;
-- Counting the number to be displayed on 4-digit 7-segment Display
-- on Basys 3 FPGA board
process(clock_1000hz, reset)
begin
       if(reset='1') then
           one_second_counter <= (others => '0');
       elsif(rising_edge(clock_1000hz)) then
           if(one_second_counter>=x"5F5E0FF") then
               one_second_counter <= (others => '0');
           else
               one_second_counter <= one_second_counter + "0000001";
           end if;
       end if;
end process;
one_second_enable <= '1' when one_second_counter=x"5F5E0FF" else '0';
process(clock_1000hz, reset)
begin
       if(reset='1') then
           displayed_number <= (others => '0');
       elsif(rising_edge(clock_1000hz)) then
            if(one_second_enable='1') then
               displayed_number <= displayed_number + x"0001";
            end if;
       end if;
end process;
end Behavioral;

BCD to Seven segment display::

process(LED_BCD)
begin
   case LED_BCD is
   when "0000" => LED_out <= "0000001"; -- "0"     
   when "0001" => LED_out <= "1001111"; --

"1"
   when "0010" => LED_out <= "0010010"; -- "2"
   when "0011" => LED_out <= "0000110"; -- "3"
   when "0100" => LED_out <= "1001100"; -- "4"
   when "0101" => LED_out <= "0100100"; -- "5"
   when "0110" => LED_out <= "0100000"; -- "6"
   when "0111" => LED_out <= "0001111"; --

"7"
   when "1000" => LED_out <= "0000000"; -- "8"     
   when "1001" => LED_out <= "0000100"; -- "9"
   when "1010" => LED_out <= "0000010"; -- a
   when "1011" => LED_out <= "1100000"; -- b
   when "1100" => LED_out <= "0110001"; -- C
   when "1101" => LED_out <= "1000010"; -- d
   when "1110" => LED_out <= "0110000"; -- E
   when "1111" => LED_out <= "0111000"; -- F
   end case;
end process;


Related Solutions

C++ Write the code to implement a complete binary heap using an array ( Not a...
C++ Write the code to implement a complete binary heap using an array ( Not a vector ). Code for Max heap. Implement: AddElement, GetMax, HeapSort, ShuffleUp, ShuffleDown, etc Set array size to 31 possible integers. Add 15 elements 1,3,27,22,18,4,11,26,42,19,6,2,15,16,13 Have a default constructor that initializes the array to zeros.. The data in the heap will be double datatype. PART 2 Convert to the program to a template, test with integers, double and char please provide screenshots thank you so...
Python code Assignment Overview In this assignment you will practice with conditionals and loops (for). This...
Python code Assignment Overview In this assignment you will practice with conditionals and loops (for). This assignment will give you experience on the use of the while loop and the for loop. You will use both selection (if) and repetition (while, for) in this assignment. Write a program that calculates the balance of a savings account at the end of a period of time. It should ask the user for the annual interest rate, the starting balance, and the number...
Write the code to implement the concept of inheritance forVehicles. You are required to implement inheritance...
Write the code to implement the concept of inheritance forVehicles. You are required to implement inheritance betweenclasses. You have to write four classes in C++ i.e. one superclass, two sub classes and one driver class. Vehicle is the super class whereas Bus and Truck are sub classesof Vehicle class. Transport is a driver class which contains mainmethod. Detailed description of Vehicle (Super class): The class Vehicle must have following attributes: 1. Vehicle model 2. Registration number 3. Vehicle speed (km/hour)...
In Java For this assignment you will implement two methods, find() and replace() relating to Binary...
In Java For this assignment you will implement two methods, find() and replace() relating to Binary Search Trees. These methods are both to be recursive functions. The signatures for those functions must be: /* This method takes a tree node and a key as an argument and returns the tree node if the key is found and returns null if the key is not found. */ BST find(BST T, char key) /* This method takes a tree node and a...
Overview For this assignment, design and implement the methods for a class that can be used...
Overview For this assignment, design and implement the methods for a class that can be used to represent a quadratic equation. int main() has already been written for this assignment. It is available for download from Blackboard or by using the following link: http://faculty.cs.niu.edu/~byrnes/csci240/pgms/240pgm8.cpp All that needs to be done for this assignment is to add the class definition and method implementation to the above CPP file. The Quadratic class Data Members The class contains three data members: an integer...
Implement a Binary tree using an array using class.
Implement a Binary tree using an array using class.
1. Design and implement a 4 bit binary to excess 3 code converter using CMOS transistors....
1. Design and implement a 4 bit binary to excess 3 code converter using CMOS transistors. (Note: Students are expected to design the circuit with truth table, solve the output expression by use of K Map or suitable circuit Reduction technique and implement using CMOS transistors.)
Please do this in java program. In this assignment you are required to implement the Producer...
Please do this in java program. In this assignment you are required to implement the Producer Consumer Problem . Assume that there is only one Producer and there is only one Consumer. 1. The problem you will be solving is the bounded-buffer producer-consumer problem. You are required to implement this assignment in Java This buffer can hold a fixed number of items. This buffer needs to be a first-in first-out (FIFO) buffer. You should implement this as a Circular Buffer...
Overview For this assignment, implement and use the methods for a class called Seller that represents...
Overview For this assignment, implement and use the methods for a class called Seller that represents information about a salesperson. The Seller class Use the following class definition: class Seller { public: Seller(); Seller( const char [], const char[], const char [], double ); void print(); void setFirstName( const char [] ); void setLastName( const char [] ); void setID( const char [] ); void setSalesTotal( double ); double getSalesTotal(); private: char firstName[20]; char lastName[30]; char ID[7]; double salesTotal; };...
Overview For this assignment, implement and use the methods for a class called Seller that represents...
Overview For this assignment, implement and use the methods for a class called Seller that represents information about a salesperson. The Seller class Use the following class definition: class Seller { public: Seller(); Seller( const char [], const char[], const char [], double ); void print(); void setFirstName( const char [] ); void setLastName( const char [] ); void setID( const char [] ); void setSalesTotal( double ); double getSalesTotal(); private: char firstName[20]; char lastName[30]; char ID[7]; double salesTotal; };...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT