Level/Adding Bytes

From Turing Complete
Section Arithmetic
Type Component
Prerequisites Double the Number
Full Adder
Bit Switch
Unlocks Negative Numbers
Input Selector
Add
Scored Yes
High score 83
API byte_adder (16)

In this level, you are tasked with designing a component that can ADD together two byte values. To accomplish this, you will need to use the 1-bit Adder component (call Full Adder) you created earlier on to perform bitwise addition on the two numbers.

To complete the level, you will need two Byte Splitter components, one 8 Bit Maker component, and eight Full Adders. First, hook up each byte input node to a Byte Splitter, so you can start working with each value bit-by-bit. Next, for each pair of bits between each byte value (each first bit, each second bit, etc.), you will need to use one Adder component to perform addition on the two bits. For each pair of bits between the two bytes, hook them up to a Full Adder component to add the two bits together. Consolidate the outputs of each Adder using a 8 Bit Maker component, and link its restored byte output to the level's byte output node.

Also notice that the level has an input and an output for a Carry bit. This is where the third bit in the 1-bit Full Adder component comes in handy, as it allows those components to be chained together in order to add together arbitrarily large numbers. To integrate the Carry functionality into this component, first connect the level's Carry bit input node up to the third input of the first Full Adder component. Then connect each Adder component's second output to the next Adder's third input. Continue chaining the components together for each of the eight Adder components, and for the final Adder, link its Carry output to the level's Carry output node itself. From here, the level will be complete.