Scrap Mechanic

Scrap Mechanic

Not enough ratings
8-bit ALU
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
181.611 KB
Aug 17, 2016 @ 2:17pm
Aug 20, 2016 @ 11:39am
3 Change Notes ( view )

Subscribe to download
8-bit ALU

Description
Arithmetic logic unit (ALU): performs arithmetic and bitwise logical operations on 8-bit numbers. This ALU comes with sixteen instructions and a built-in accumulator (AR) for storing its data.

Quick example:
1) Set instruction to 0001, SET (green switches, dark to light).
2) Set input to 00000011, 3 (pink switches, dark to light).
3) Press clock (yellow switch). AR is now set to 3 (cyan output).
4) Set instruction to 1010, MUL.
5) Set input to 00000111, 7.
6) Press clock. AR has now been multiplied with 7.
If the result is 00010101, 21, you have multiplied 3 and 7 successfully!

I/O
Input (Light green) - 4-bit instruction* (light=LSB)
Input (Pink, standing) - 8-bit input
Input (Yellow, Button) - 1-bit clock: activates write-state

Output (Cyan, standing) - 8-bit value of AR

*Instructions
code - name (output): description
0000 - NOP (ar): No operation
0001 - SET (input): Load input into AR
0010 - CLR (0): Reset AR
0011 - NOT (¬ar): NOT all bits in AR
0100 - AND (ar & input): AND all bits in AR and input
0101 - OR (ar | input): OR all bits in AR and input
0110 - INC (ar + 1): Increment AR
0111 - DEC (ar - 1): Decrement AR
1000 - ADD (ar + input): Add input to AR
1001 - SUB (ar - input): Subtract input from AR
1010 - MUL (ar * input): Multiply input with AR
1011 - LSL (ar <<): Logical left shift of all bits
1100 - LSR (ar >>): Logical right shift of all bits
1101 - ASR (ar >>): Arithmetic right shift (for two's complement)
1110 - ROL (ar << ar): Rotate all bits left
1111 - ROR (ar >> ar): Rotate all bits right

See INC (8-bit Incrementer)
See DEC (8-bit Decrementer)
See ADD (8-bit Adder)
See MUL (8-bit Multiplier)

See AR (8-bit D-latch Safe)

As seen in the picture:
See 8-bit Bin2BCD Display
See ALU Function Display