I think this might actually be quite simple but I can't find info on it anywhere and I can't think how I would do it. I want to split an 8 bit BCD into two 4 bit BCDs so for example if I get an input of:

01011100 I want two separate outputs of 0101 and 1100.

Similarly how could I then split the 0101 into 4 outputs of 0, 1, 0, 1 and the same for the 1100 into 1, 1, 0, 0?

  • \$\begingroup\$ It's just a lane change. I don't see the complexity here. Is there something I'm missing? \$\endgroup\$
    – jonk
    Feb 3, 2021 at 13:41
  • \$\begingroup\$ This takes no hardware whatsoever. \$\endgroup\$
    – user16324
    Feb 3, 2021 at 14:20

1 Answer 1


In VHDL, you can directly slice the array. Let's assume allparts is the 8 bit BCD array you want to slice, and first_part and second_part are the 4 bit BCD signals you need.

allparts, first_parts and second_parts is of type std_logic_vector.

firstpart <= allparts(7 downto 4);
secondpart <= allparts(3 downto 0);

...or if firstpart and secondpart are simply alternate ways to refer to part of the allparts signal, you may want to use an alias:

alias firstpart is allparts(7 downto 4);
alias secondpart is allparts(3 downto 0);

Credits: Charles Steinkuehler https://stackoverflow.com/a/10376420/12311164

  • \$\begingroup\$ Is there a logic gate way as well? \$\endgroup\$
    – Matt
    Feb 3, 2021 at 13:43
  • \$\begingroup\$ @Matt you don't need a logic gate here since you don't have a function for the logic gate to perform. You can either directly connect 4 bits as a separate signal or use a buffer. \$\endgroup\$ Feb 3, 2021 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.