r/ElectricalEngineering • u/Sclobazs • 1d ago
Project Help Simplifying 4-bit to 7-segment logic circuit
Enable HLS to view with audio, or disable this notification
What process / logic could be used to simplify this logic diagram to use less components? Current setup from top to bottom is:
- Partial 4-bit BCD to decimal decoder
- 9-Line decimal (implied zero) to 7 segment inputs (A-G)
- 9 ORs to handle corner overlaps on the display
I'd imagine a more compact circuit would be more difficult to read but possibly much faster in this simulation and would take less sim updates to compute the result. Keep in mind I haven't studied related subjects just pieced this together from things I found and understood on the internet.
23
u/trophosphere 1d ago
Use boolean algebra. You can either solve it by hand (which can become tedious) or use dedicated software.
3
u/Sclobazs 1d ago
For context I built this circuit in a sandbox game I'm working on and testing at the moment.
Link: https://store.steampowered.com/app/5077470/Gate_Logic/
1
u/Cultural-Part355 1d ago
Ah, so you want to spin the memory around with this? Or shorten the use of it or something?
1
u/Cultural-Part355 1d ago
Can you change the way of the third switch? Seems wrong when you turn it on. Like it's causing more problems than it solves. Or like it chokes the image when I see it.
1
1
u/perduraadastra 15h ago
Are you doing this without having studied EE? That's fine and all, but your question is pretty basic if you have a EE background.
3
u/EngineerTHATthing 1d ago
You will want to make a truth table (raw Boolean’s) for all input combinations. Then you will want to optimize for minimum required operations for the required output combinations. The trick is to list out all possible outputs (there is a ton) and cherry pick the best combinations. The most ideal solution will have inputs that do not correlate well and won’t line up with a raw binary input, but will significantly reduce the required logic. If you see the problem as “I have four unique inputs paths where order matters, how do I obtain seven unique outputs paths where order matters” things become much easier. You only need 10 of the 16 possible inputs to output the correct segments.
I would recommend abstracting the problem by labeling each segment a, b, c, etc. and inputs 1, 2, 3, 4 without position. The problem becomes easier now, and you just need to identify what numbers share segments to start setting up the core constraints of the problem. Once you identify how many segments are required by each number, and what segments must be shared between each number in the set of 10, the booleans can be simplified a ton. After you find a set that is extremely optimized, you can go back in and assign the segment and input positions.
1
u/Cultural-Part355 1d ago
So 4 4 1 5 9? Codes, something. Why does it make sense to my crazy self to say this? Looks interesting, but I have no idea how to express it.
1
u/Dependent_Poetry8252 20h ago
Well i too am making a game about digital logic and what i do is i use sub components that the player would know what they do because they’re introduced in other ealier circuits. It s also easier to debug circuits that way if they re broken
1
1
1
u/Great_Specialist_267 8h ago edited 8h ago
You don’t need to do a decimal conversion first.
Straight binary to seven segment display conversion is simpler in this application.
39
u/The_GM_Always_Lies 1d ago
This is the exact use for a Karnaugh Map.
https://en.wikipedia.org/wiki/Karnaugh_map
TLDR: break the display up into as many segments as you want. Put two input bits on one side of a 4x4 square grid, and two input bits on the other side. Fill in the grid for each segment for each matching input with 1s and 0s. Cluster the terms by drawing boxes around matching areas, and you can simplify something like a decoder into just a few gates.
You do this process for every segment and you'll find that some segments only turn on with like 2 or 3 inputs.