home *** CD-ROM | disk | FTP | other *** search
- ;---------------------------------------------------------
- ; This design decodes a 4-bit number into 7 signals which
- ; can drive a 7-segment LED digit. The LEDs in the digit
- ; should light in a pattern that represents the number.
- ;---------------------------------------------------------
- TITLE 7-segment led decoder
-
- CHIP leddecod NFX780_84
-
-
- ;---------------------------------------------------------
- ; Inputs and outputs for the LED decoder
- ;---------------------------------------------------------
-
- ;* This is the 4-bit input to the LED decoder
- PIN 47 d0 ;* least-significant bit (LSB)
- PIN 48 d1
- PIN 49 d2
- PIN 50 d3 ;* most-significant bit (MSB)
- PIN 51 unused0
- PIN 77 unused1
- PIN 78 unused2
-
- ;* These are the pins that drive the LED segments
- PIN 34 s0 ;* +----s6---+
- PIN 35 s1 ;* | |
- PIN 36 s2 ;* s5 s4
- PIN 37 s3 ;* | |
- PIN 39 s4 ;* +----s3---+
- PIN 40 s5 ;* | |
- PIN 41 s6 ;* s2 s1
- ;* | |
- ;* +----s0---+
-
-
- ;---------------------------------------------------------
- ; Below is the truth table for driving the LEDs given the
- ; 4-bit number. A 1 on an output will make the
- ; corresponding LED segment light up; a 0 will make the
- ; segment stay dark. The truth-table gives the appropriate
- ; outputs to light the LED segments for the digits 0--9.
- ;---------------------------------------------------------
-
- T_TAB ( d3 d2 d1 d0 >> s0 s1 s2 s3 s4 s5 s6 )
- 0 0 0 0 : 1 1 1 0 1 1 1 ;* 0
- 0 0 0 1 : 0 1 0 0 1 0 0 ;* 1
- 0 0 1 0 : 1 0 1 1 1 0 1 ;* 2
- 0 0 1 1 : 1 1 0 1 1 0 1 ;* 3
- 0 1 0 0 : 0 1 0 1 1 1 0 ;* 4
- 0 1 0 1 : 1 1 0 1 0 1 1 ;* 5
- 0 1 1 0 : 1 1 1 1 0 1 1 ;* 6
- 0 1 1 1 : 0 1 0 0 1 0 1 ;* 7
- 1 0 0 0 : 1 1 1 1 1 1 1 ;* 8
- 1 0 0 1 : 1 1 0 1 1 1 1 ;* 9
-
-
- ;---------------------------------------------------------
- ; Simulate the LED decoder
- ;---------------------------------------------------------
- SIMULATION
- TRACE_ON d0 d1 d2 d3 s0 s1 s2 s3 s4 s5 s6
- SETF /d3 /d2 /d1 /d0 ;* digit = "0"
- SETF /d3 /d2 /d1 d0 ;* digit = "1"
- SETF /d3 /d2 d1 /d0 ;* digit = "2"
- SETF /d3 /d2 d1 d0 ;* digit = "3"
- SETF /d3 d2 /d1 /d0 ;* digit = "4"
- SETF /d3 d2 /d1 d0 ;* digit = "5"
- SETF /d3 d2 d1 /d0 ;* digit = "6"
- SETF /d3 d2 d1 d0 ;* digit = "7"
- SETF d3 /d2 /d1 /d0 ;* digit = "8"
- SETF d3 /d2 /d1 d0 ;* digit = "9"
-
-