Sunday 15 February 2015

ALU Design - 2.1

Changes from v1.x

  • Updated to the v2.0 Architecture and the use of a dedicated common CPU bus for the CPU boards
  • The three boards of the v1 ALU have been combined into a single board

Schematics

The General Register Board design is split across four schematics
  • Common CPU bus connector
  • ALU Operations
  • ALU flags
  • Caps

Common CPU bus connector

The common CPU bus connector is shown below.
Common CPU Bus connector

ALU Operations

The ALU can perform 3 mathematical operations and 3 logical operations.
  • AND : logical AND (left AND right)
  • OR : logical OR (left OR right)
  • XOR : logical XOR (left XOR right)
  • ADD : mathematical addition without carry (left + right + 0)
  • ADC : mathematical addition with carry in from the control register (left + right + C)
  • SUB : mathematical subtraction (left - right)
The ALU performs subtraction by calculating the two's complement negative of the right input and performing an addition e.g. left + (-right)

The ALU has 4 input controls

Carry Select Control

SEL_C_IN_1 and SEL_C_IN_2 are used to select the carry input
  • 0 - ALU carry input is zero
  • 1 - ALU carry input is one
  • 2 - ALU carry input is taken from the carry flag
  • (3 - ALU carry input is zero)

Invert Right Input Control

ALU_INV_R is used to invert the right input for subtraction operations
  • 0 - do not invert (input xor'd 0)
  • 1 - invert (input xor'd with 1)

Operation Selection Control

SEL_ALU_OP_1 and SEL_ALU_Op_2 are used to select the ALU operation to output onto the Z bus.
  • 0 - OR
  • 1 - AND
  • 2 - XOR
  • 3 - ADD

ALU Output Enable Control

OE_ALU is used to enable the ALU output onto the Z bus
  • 0 - high Z state
  • 1 - output enabled
ALU Operations

ALU Flags

The ALU flags circuit calculates the Z (zero) & V (overflow). The C (carry) is calculated by the adder and the N (negative) flag is simply the Z7 output.

The overflow flag is only meaningful if two's complement numbers are being added. The output is High to indicate an overflow if the following conditions are met
  • Adding two positive numbers and the result is negative; or
  • Adding two negative numbers and the result is positive
If unsigned maths is being performed then the Carry flag should be checked to indicate overflow instead. 

ALU flags
The ALU Zero flag is calculated by simply OR'ing all the outputs which outputs Low if the output is zero.

The ALU flags are always calculated and it is up to the micro-code to determine when they are applicable and should be saved in the ALU flags register for inspection.

PCB board

The PCB board is shown below

ALU PCB

Parts List

Part     Value          Package      Library  Position (inch)       Orientation

C1       0.1uF          C050-030X075 rcl      (2.05 0.3)            R90
C2       0.1uF          C050-030X075 rcl      (2.6 2.5)             R180
C3       0.1uF          C050-030X075 rcl      (4.8 0.25)            R90
C4       0.1uF          C050-030X075 rcl      (1.15 1.1)            R90
C5       0.1uF          C050-030X075 rcl      (2.4 1.1)             R90
C6       10uF           E5-5         rcl      (5.75 0.25)           R90
C7       0.1uF          C050-030X075 rcl      (3.55 1.1)            R90
C8       0.1uF          C050-030X075 rcl      (4.85 1.1)            R90
C9       0.1uF          C050-030X075 rcl      (1.2 3.75)            R180
C10      0.1uF          C050-030X075 rcl      (2.6 3.75)            R180
C11      0.1uF          C050-030X075 rcl      (3.6 3.75)            R180
C12      0.1uF          C050-030X075 rcl      (4.55 3.75)           R180
C13      0.1uF          C050-030X075 rcl      (5.35 3.6)            R180
C14      0.1uF          C050-030X075 rcl      (5.35 2.6)            R180
C15      0.1uF          C050-030X075 rcl      (1.2 2.55)            R180
C16      0.1uF          C050-030X075 rcl      (3.65 2.5)            R180
C17      0.1uF          C050-030X075 rcl      (4.55 2.5)            R180
C18      0.1uF          C050-030X075 rcl      (5.35 1.4)            R180
IC1      74HC08N        DIL14        74xx-eu  (3.55 3.25)           R270
IC2      74HC32N        DIL14        74xx-eu  (2.55 3.25)           R270
IC3      74HC86N        DIL14        74xx-eu  (4.5 3.25)            R270
IC4      74ACT283N      DIL16        74xx-eu  (1.15 3.2)            R270
IC5      74HC86N        DIL14        74xx-eu  (5.3 3.1)             R270
IC6      74HC153N       DIL16        74xx-eu  (1.9 1.15)            R180
IC7      74HC153N       DIL16        74xx-eu  (0.65 1.15)           R180
IC8      74HC86N        DIL14        74xx-eu  (5.3 2.1)             R270
IC9      74HC32N        DIL14        74xx-eu  (2.55 2)              R270
IC10     74HC08N        DIL14        74xx-eu  (3.6 2)               R270
IC11     74HC86N        DIL14        74xx-eu  (4.5 2)               R270
IC12     74ACT283N      DIL16        74xx-eu  (1.15 2.05)           R270
IC13     74HC153N       DIL16        74xx-eu  (4.3 0.3)             R180
IC14     74HC153N       DIL16        74xx-eu  (3.05 1.15)           R180
IC15     74HC153N       DIL16        74xx-eu  (4.3 1.15)            R180
IC16     74HC251N       DIL16        74xx-eu  (1.5 0.35)            R180
IC17     4078N          DIL14        40xx     (5.3 0.95)            R270
X1       MAB64          MAB64        con-vg   (6.2 1.95)            R0