How to combine two, 4-bit words into one 6-bit word.

What I want to achieve: Using a matrix keyboard, I would like to control six addresses (A0-A5) of a parallel EEPROM memory in the range from 000000 to 111111. After selecting two decimal numbers on the matrix keyboard, for example, '2' and '3', I would get two 4-bit words (0010) and (0011) at the output, from which I would then like to obtain the number '23' as a 6-bit word (010111). What logic operations should I perform to achieve this result?

This is a part of my project - a binary music / pulse sequencer based on logic gates. The sequencer works in two modes - the first is generating 64 sequences of 8 pulses (triggers) each. Each single sequence is recorded using an ADC, via a potentiometer. In other words, one 'step' is one 8-bit sequence. After recording 64 combinations, the sequencer is switched to playback mode in a loop - from 0-63. It is possible to reset at any time using an external clock and reset signal. The second mode is playback of 8 waveforms stored in the EEPROM memory, 64 bytes each, which allow for modulation (e.g., LFO) through the DAC. Both modes of the sequencer can be used simultaneously - you can control an external device using the generated pulses and also modulate - both modes, however, are synchronized using the same clock. Increasing the speed of the pulses at the sequencer output increases the frequency of the modulation waveforms. The sequencer also has an LFSR source and a 'glide' function. The 'glide' function is a circuit at the DAC output that 'softens' voltage jumps. enter image description here

The memory cell number is displayed here: enter image description here

The part of the circuit controls the memory cells with the clock: enter image description here

  • \$\begingroup\$ What do you want to happen if the selection is, for example, "85"? \$\endgroup\$
    – The Photon
    Jan 1 at 21:08
  • \$\begingroup\$ You can use any logic operations you want. It does not matter how the result ends up being what it is. But you might want to be clear that when you push '2' and '3' it means 23 in decimal? If so, do you recall how decimal numbers work? \$\endgroup\$
    – Justme
    Jan 1 at 21:13
  • 1
    \$\begingroup\$ @JerzyPrzezdziecki You push '2', multiply it by 10, you get 20, push '3' and add it, and get 23. The other thing is, it might be harder to work in decimals than in binary, hex, or octal. Where is this matrix keyboard connected, what output you get and where? To digital logic? To an MCU running code? \$\endgroup\$
    – Justme
    Jan 1 at 21:32
  • 3
    \$\begingroup\$ It seems way easier to enter the address as two digits base 8. Do you intend to [select two] numbers on [one and the same] matrix keyboard? \$\endgroup\$
    – greybeard
    Jan 1 at 21:33
  • 1
    \$\begingroup\$ @JerzyPrzezdziecki I have to wonder what is the motivation for this project? Is this school work? \$\endgroup\$
    – Justme
    Jan 1 at 21:48

1 Answer 1


Store the 1st number. Have an adder which uses it as the first number to be added together as shifted left by 1 bit position and then shifted left by 3 bit positions. That's multiply by 10. Then add the 2nd number. Turn on the error flag if the result is not 0....63.

This sequence can be performed without programmable devices. I guess that was the way to make things as late as 45...50 years ago.

If you can program a processor, multiply the 1st number by 10 and add the second number. That's already said more than once as "do BCD to binary conversion" Check the range.

As well you could fill the memory so that you get the right numbers out when you use 8 address bits and use the first number as Addr0...Addr3 and the second number as Addr4...Addr7. You must have a free output code for "invalid input". Its existence is not clear, because you didn't tell do more address bits come from elsewhere.

ADD: The italicized text part of the answer became obsolete when the question was edited to close out these possibilities by inserting a schematic. I must admit it's not at all clear what useful or interesting the circuit does (other than raises some thinking "what it might be?"), but that can be only my limitation.

  • \$\begingroup\$ Thanks will try that. \$\endgroup\$ Jan 2 at 10:23

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.