Skip to main content

ALU Chips

Description

Most operations of the ALU are provided by two 4-bit ALU chips (74-382) chained together to form a single 8-bit unit. These chips provide a carry and overflow output pin which we are using to update the OF and CF if desired.
The 74-382 IC supports the following operation modes:

  • CLEAR (output 0)
  • A + B
  • A - B
  • B - A
  • A ⊻ B (bitwise A xor B)
  • A | B (bitwise A or B)
  • A & B (bitwise A and B)
  • PRESET (output -1)

However, the carry input and output for subtraction behaves in an unintuitive manner: Setting the input to high means not subtracting one, setting the input to low means subtracting one. The same applies to the output: High means no carry, low means carry. To hide this behavior from other parts of the ALU, the carry bit passes through a "fixing circuit" both, before entering the ALU chips and after leaving the ALU chips. Thus, we implement subtraction with intuitive carries.

Implementation in Hardware

As described, we use two 4-bit ALU chips (74-382 aluHigh and aluLow) to implement all desired binary operations. Fixing the carry for subtraction is done using XOR-gates (74-86 carryFix): The carry is XOR-ed with one, before entering and after leaving the ALU chips, if the operation is SUB (or some other operation where the carry input and output are irrelevant). We get the one by XOR-ing two bits of the ALU_OPERATION control lines that just so happen to be different for subtraction but identical for all operations, where we care about the carry not being inverted.

Schematic

ALU-Arith Schematic