Logic gates: how to produce (32-x) 1s followed by x 0s given 5 bit input x

-2

For example:

input 0 should give 0xffffffff (i.e. all ones)
input 1 should give 0xfffffffe (31 ones followed by one zero)
input 32 should give 0x80000000 (a single one followed by 31 zeroes)

Looking for minimal gate usage & preferably short length. My current solution is to decode the input and chain OR's, with one bit's output feeding into the next OR. I feel like this is nowhere near optimal, but couldn't figure out how to improve upon it.

cpu-architecture
boolean-logic
circuit
digital-logic
asked on Stack Overflow Nov 1, 2020 by Richard Yan • edited Nov 1, 2020 by Peter Cordes

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0