7-segment decoder generator
Preview: choose an address, click segments to change its glyph.
Live preview from the table
0000 shows 0
| D[4] | Char | a | b | c | d | e | f | g | Hex |
|---|---|---|---|---|---|---|---|---|---|
| 0000 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0x3f |
| 0001 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0x06 |
| 0010 | 2 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 0x5b |
| 0011 | 3 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 0x4f |
| 0100 | 4 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0x66 |
| 0101 | 5 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0x6d |
| 0110 | 6 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0x7d |
| 0111 | 7 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0x07 |
| 1000 | 8 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0x7f |
| 1001 | 9 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0x67 |
| 1010 | A | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 0x77 |
| 1011 | b | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0x7c |
| 1100 | C | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0x39 |
| 1101 | d | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0x5e |
| 1110 | E | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0x79 |
| 1111 | F | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 0x71 |
Bit 0 = a, bit 7 = decimal point (always 0 here). A ROM cannot store a don't care, so those rows are 0 in the ROM.
Logisim’s 7-Segment Display: which input is which
The segments are a at the top, then b, c, d clockwise, e and f, with g in the middle. The display’s inputs are not in that order. From our measured geometry (F44):
loc Logisim storesPorts as a table
| # | Port | Direction | Width | Offset from anchor |
|---|---|---|---|---|
| 1 | Segment A | in | 1 | (20, 0) |
| 2 | Segment B | in | 1 | (30, 0) |
| 3 | Segment C | in | 1 | (20, 60) |
| 4 | Segment D | in | 1 | (10, 60) |
| 5 | Segment E | in | 1 | (0, 60) |
| 6 | Segment F | in | 1 | (10, 0) |
| 7 | Segment G | in | 1 | (0, 0) |
| 8 | Decimal point | in | 1 | (30, 60) |
| a | (20, 0) | 0 |
|---|---|---|
| b | (30, 0) | 1 |
| c | (20, 60) | 2 |
| d | (10, 60) | 3 |
| e | (0, 60) | 4 |
| f | (10, 0) | 5 |
| g | (0, 0) | 6 |
| Decimal point | (30, 60) | 7 |
No rows match.
Hovering a port in Logisim shows “Segment A” to “Segment G” and “Decimal point” (F44). The 2.7.1 display has the same ports. Attributes we know of: Active On High (the XML name is active) and the colours. We did not test what Active On High does to the drawing.
Three ways to build the decoder
| Gates, one equation per segment | A lab asks for a gate-level design. | Yes: circuit below, 16 of 16 rows |
|---|---|---|
| A ROM with 16 words | You want the fastest build or an easy change. | Yes: 16 of 16 words, and the display showed 0 (F89) |
| A built-in part | A project, not a graded lab: the Hex Digit Display, or the BFH decoder. | BFH decoder: 0 to 9 yes, 10 to 15 float (F89) |
No rows match.
With gates
For BCD with 10 to 15 as don’t care, the tool’s equations (Logisim syntax, a space is AND) are:
a = D3 + ~D2 ~D0 + D2 D0 + D1
b = ~D2 + ~D1 ~D0 + D1 D0
c = D2 + ~D1 + D0
d = D2 ~D1 D0 + ~D2 D1 + ~D2 ~D0 + D1 ~D0
e = ~D2 ~D0 + D1 ~D0
f = D3 + D2 ~D1 + D2 ~D0 + ~D1 ~D0
g = D3 + ~D2 D1 + D2 ~D1 + D1 ~D0
Describe this circuit
Components: Input pin D3; Input pin D2; NOT Gate 1; Input pin D1; NOT Gate 2; Input pin D0; NOT Gate 3; AND Gate 1; AND Gate 2; AND Gate 3; AND Gate 4; AND Gate 5; AND Gate 6; AND Gate 7; AND Gate 8; AND Gate 9; OR Gate 1; Output pin a; OR Gate 2; Output pin b; OR Gate 3; Output pin c; OR Gate 4; Output pin d; OR Gate 5; Output pin e; OR Gate 6; Output pin f; OR Gate 7; Output pin g.
- Input pin D3 connects to OR Gate 1, OR Gate 6, OR Gate 7 (net D3).
- Input pin D2 connects to NOT Gate 1, AND Gate 2, AND Gate 5, AND Gate 8, AND Gate 9, OR Gate 3 (net D2).
- NOT Gate 1 connects to AND Gate 1, AND Gate 6, OR Gate 2.
- Input pin D1 connects to NOT Gate 2, AND Gate 4, AND Gate 6, AND Gate 7, OR Gate 1 (net D1).
- NOT Gate 2 connects to AND Gate 3, AND Gate 5, AND Gate 8, OR Gate 3.
- Input pin D0 connects to NOT Gate 3, AND Gate 2, AND Gate 4, AND Gate 5, OR Gate 3 (net D0).
- NOT Gate 3 connects to AND Gate 1, AND Gate 3, AND Gate 7, AND Gate 9.
- AND Gate 1 connects to OR Gate 1, OR Gate 4, OR Gate 5.
- AND Gate 2 connects to OR Gate 1.
- AND Gate 3 connects to OR Gate 2, OR Gate 6.
- AND Gate 4 connects to OR Gate 2.
- AND Gate 5 connects to OR Gate 4.
- AND Gate 6 connects to OR Gate 4, OR Gate 7.
- AND Gate 7 connects to OR Gate 4, OR Gate 5, OR Gate 7.
- AND Gate 8 connects to OR Gate 6, OR Gate 7.
- AND Gate 9 connects to OR Gate 6.
- OR Gate 1 connects to Output pin a (net a).
- OR Gate 2 connects to Output pin b (net b).
- OR Gate 3 connects to Output pin c (net c).
- OR Gate 4 connects to Output pin d (net d).
- OR Gate 5 connects to Output pin e (net e).
- OR Gate 6 connects to Output pin f (net f).
- OR Gate 7 connects to Output pin g (net g).
Download the circuit and its vector. It has output pins only: connect them to the display as the pin order above shows, or use tunnels (tunnels). Logisim’s own Combinational Analysis can also build a circuit from the table.
With a ROM
v2.0 raw
3f 6 5b 4f 66 6d 7d 7
7f 67 77 7c 39 5e 79 71
Download the image, the ROM decoder circuit and its vector. The circuit file already has a splitter and a display wired. Loading images: ROM and the memory image tool. The ROM decoder from the tool is the same design with your table.
With a built-in part
The BFH BCD to seven segment decoder and the Hex Digit Display are covered on the display page.
Active high or active low
Logisim’s display lights a segment when its input is 1. A common-anode display on a real board lights on 0. In Logisim you have two choices, and the tool offers both: invert the data, or keep the data and set the display’s Active On High attribute to off. The table shows what each does to the bits.
| Every segment lit except the ones you want | The data and the display disagree about polarity. |
|---|---|
| 8 shows as blank | Same cause, or the display's inputs are not driven. |
| Segments in the wrong places | Outputs wired in a to g order instead of the display's own order. |
No rows match.
Glyph shapes
The default shapes are those of the Hex Digit Display, which we checked on screen: 7 is a, b, c only, and 9 has no bottom bar. Choose “with tails” for a 7 with f and a 9 with d.
Four Hex Digit Displays driven by the constants 6, 7, 9 and 1. The 6 has a top bar and a closed lower loop, the 7 is the top bar and the right side only, the 9 has the top, both upper sides, the middle bar and the lower right side but no bottom bar, and the 1 is the right side.
Limits
Four-bit decoders are the default; custom lists up to 64 entries give a table, equations and a ROM image, but the .circ files need 16 entries (ROM) or 6 input bits (gates). The ROM decoder file is made from our verified ROM circuit, so its pin names are N and W. Not in this version: the decimal point, K-maps per segment, 14 and 16 segment displays and a multi-digit generator. The .circ files are in the 5.0.0 format and do not open in classic 2.7.1 (F04); use the ROM image there. We did not test the digital-clock use of this tool.
Privacy
Everything is computed in your browser and nothing is sent anywhere.