Majority Voter, Two Ways
Three inputs vote on one output: high wins when at least two inputs are high. The template contains a working truth-table implementation. Add a smaller gate expression with the same behavior, leaving the original available for comparison.
This is optional practice in K-map simplification and adding another implementation behind an existing interface.
- add a second architecture named
minimizedto the existingmajority_voterentity. Leave the givenmintermsarchitecture untouched.
The testbench instantiates the given implementation and yours side by side and drives all eight input combinations; both must produce the majority on every row.
Interface (both implementations)
| Port | Direction | Type | Description |
|---|---|---|---|
a_i | in | 1 bit | Voter input A |
b_i | in | 1 bit | Voter input B |
c_i | in | 1 bit | Voter input C |
vote_o | out | 1 bit | Majority: '1' when at least two inputs are '1' |
Behavior
vote_ois '1' when two or three inputs are '1', and '0' otherwise- Both implementations are checked on every one of the 8 input combinations
Constraints
Derive a simplified sum-of-products expression from a K-map. The tests compare output values; they do not count terms in your source.
- Don't modify the given implementation; the testbench checks it too.
- Expect the first run to fail before your unit exists: it stops with
cannot find architecture "minimized" of entity "majority_voter". Write the architecture and the error disappears.
Loading editor...
Click Run to execute your code. Output will appear here.