Parity generator

Task:  Design a circuit for generating a parity bit for 8-bit input word. The 8-bit input word should be set by means of switches SW0-SW7 on the prototype board. Parity should be presented on the LED display: E - even number of ‘ones’ in the 8-bit input word, O - odd number of ones.

Widok płytki

Fig. 1.  Photograph of the Digilent Spartan 3 board.


Perform a functional simulation and verify the circuit practically by programming the prototype board. On the prototype board there are 4 seven-segment displays with common anode connected for multiplexed operation. Present the result on the AN3 display. The multiplexed connection is made by a common connection of all segment leads, ie, the common connection of segments A of 4 displays, the common connection of segments B of 4 displays, etc. Common anodes are used to activate a given digit. Individual segments of an active digit are activated by a low logic state on the A-G leads. The activation of the individual digits is triggered by the low logic state on the AN0 - AN3 (inverted common anode) pins.

For example, if you want to suppress the digits 0-2, then you must set logic ‘1’ at the AN0 - AN2 terminals. If at the same time you want to display the sign ‘A’ on the digit 3 then assert the following signals: AN3='0' and A='0', B='0', C='0', D='1', E='0', F='0', G='0', DP='1'.

Wyświetlacz LED
Fig. 2. Connections of segments and digits of LED display. Example of displaying digit '2'.

 

UCF file for the exercise, Digilent Spartan-3 board, Spartan-3 3S200 FT256-4:

#################################################################
# Seven-segment LED display:
NET "led7_an_o<3>" LOC = "E13" ; # leftmost digit, active low
NET "led7_an_o<2>" LOC = "F14" ; # active low
NET "led7_an_o<1>" LOC = "G14" ; # active low
NET "led7_an_o<0>" LOC = "D14" ; # rightmost digit, active low
#
NET "led7_seg_o<7>" LOC = "E14" ; # segment 'A', active low
NET "led7_seg_o<6>" LOC = "G13" ; # segment 'B', active low
NET "led7_seg_o<5>" LOC = "N15" ; # segment 'C', active low
NET "led7_seg_o<4>" LOC = "P15" ; # segment 'D', active low
NET "led7_seg_o<3>" LOC = "R16" ; # segment 'E', active low
NET "led7_seg_o<2>" LOC = "F13" ; # segment 'F', active low
NET "led7_seg_o<1>" LOC = "N16" ; # segment 'G', active low
NET "led7_seg_o<0>" LOC = "P16" ; # segment 'dp', active low
#################################################################

#################################################################
# Slide switches:
# sw7 sw6 sw5 sw4 sw3 sw2 sw1 sw0
NET "sw_i<0>" LOC = "F12" ; # active high when in UP position
NET "sw_i<1>" LOC = "G12" ; # active high when in UP position
NET "sw_i<2>" LOC = "H14" ; # active high when in UP position
NET "sw_i<3>" LOC = "H13" ; # active high when in UP position
NET "sw_i<4>" LOC = "J14" ; # active high when in UP position
NET "sw_i<5>" LOC = "J13" ; # active high when in UP position
NET "sw_i<6>" LOC = "K14" ; # active high when in UP position
NET "sw_i<7>" LOC = "K13" ; # active high when in UP position
#################################################################