We gratefully acknowledge the Center of Excellence (CoE) in Integrated Circuits and Systems (ICAS) and the Department of Electronics and Communication Engineering (ECE) for providing the necessary resources and guidance. Special thanks to Dr. K R Usha Rani (Associate Dean - PG), Dr. H V Ravish Aradhya (HOD-ECE), Dr. K. S. Geetha (Vice Principal) and Dr. K. N. Subramanya (Principal) for their constant encouragement and support in facilitating this Tiny Tapeout. SKY25A submission
This module implements a Custom Arithmetic Logic Unit (ALU) with two operating modes: standard ALU mode and Neural Processing Unit (NPU) mode.
In ALU mode, the design performs:
In NPU mode, it performs simple neural-inspired computations including:
The operation is selected using a 4-bit opcode and mode bit provided via uio_in
.
The 8-bit input signal ui_in
is divided into:
ui_in[3:0]
(lower 4 bits)ui_in[7:4]
(upper 4 bits)Operation is selected via:
uio_in[3:0]
(4-bit opcode for selecting ALU/NPU function)uio_in[4]
0
: ALU mode1
: NPU modeThe 8-bit output uo_out
is structured as:
uo_out[3:0]
: ALU/NPU resultuo_out[4]
: Error flag (e.g., divide by zero)uo_out[5]
: Sign flag (MSB of result)uo_out[6]
: Carry flag (for addition/subtraction)uo_out[7]
: Zero flag (result == 0)The tt_um_customalu
is a 4-bit custom Arithmetic Logic Unit (ALU) with two operating modes:
Inputs are sampled synchronously on the rising clock edge. Operations are executed based on the selected Opcode
and Mode
.
On every rising edge of clk
:
A = ui_in[3:0]
(Operand A)
B = ui_in[7:4]
(Operand B)
Opcode = uio_in[3:0]
(Operation Selector)
Mode = uio_in[4]
(0: ALU Mode, 1: NPU Mode)
On the next clk
cycle:
Depending on the Mode
, the ALU executes one of 32 possible operations (16 ALU, 16 NPU).
The result is stored in ALU_Result
.
Flags such as Zero
, Carry
, Sign
, and Error
are updated accordingly.
Mode_reg == 0
)Includes basic and advanced operations like:
ADD
, SUB
, MUL
, DIV
AND
, OR
, XOR
, NOT
ROTATE
, GRAY CODE
GREATER
, EQUAL
PRIORITY ENCODER
, MAJORITY
, weighted functionMode_reg == 1
)Implements lightweight neural functions:
ReLU
, Threshold
, Sigmoid-like
Base neuron
, Scaled dot
, Noisy neuron
, Quadratic neuron
Equality
, Max
, Min
, Binary classification
, Inverted XOR
When rst_n
is low (active low reset):
A_reg
, B_reg
, Opcode_reg
, Mode_reg
, ALU_Result
) are cleared to 0
.Zero
, Carry
, Sign
, Error
) are reset to 0
.This ensures safe and deterministic startup and operation.
Testing can be done by providing various combinations of ui_in
and uio_in
, then observing the result and status flags on uo_out
.
Mode_reg == 0
)Opcode (bin) | Opcode (hex) | Operation | Description |
---|---|---|---|
0000 |
0x0 |
ADD | A + B , with carry, zero, and sign flags |
0001 |
0x1 |
SUB | A - B , with carry, zero, and sign flags |
0010 |
0x2 |
MUL | A * B , lower 4 bits, with zero and sign flags |
0011 |
0x3 |
DIV | A / B , handles divide-by-zero with error flag |
0100 |
0x4 |
ROTL | Rotate A left by 1 bit |
0101 |
0x5 |
ROTR | Rotate A right by 1 bit |
0110 |
0x6 |
PRIORITY ENCODER | Encodes position of most significant set bit in A |
0111 |
0x7 |
GRAY CODE | Converts A to Gray code |
1000 |
0x8 |
MAJORITY FUNCTION | `(A & B) |
1001 |
0x9 |
WEIGHTED FUNC | ((A * 3) + 2) % 17 |
1010 |
0xA |
AND | Bitwise AND of A and B |
1011 |
0xB |
OR | Bitwise OR of A and B |
1100 |
0xC |
NOT | Bitwise NOT of A |
1101 |
0xD |
XOR | Bitwise XOR of A and B |
1110 |
0xE |
GREATER THAN | 1 if A > B , else 0 |
1111 |
0xF |
EQUALITY | 1 if A == B , else 0 |
Mode_reg == 1
)Opcode (bin) | Opcode (hex) | Operation | Description |
---|---|---|---|
0000 |
0x0 |
BASE NEURON | ((A * 3) + 2) % 17 |
0001 |
0x1 |
RELU(A - B) | A - B if A > B , else 0 |
0010 |
0x2 |
SCALED DOT | (A * B) >> 2 |
0011 |
0x3 |
MAX | Maximum of A and B |
0100 |
0x4 |
MIN | Minimum of A and B |
0101 |
0x5 |
THRESHOLD | 0xF if A > 4 , else 0x0 |
0110 |
0x6 |
INVERTED XOR | Bitwise ~(A ^ B) |
0111 |
0x7 |
NOISY NEURON | (A + B + 3) % 10 |
1000 |
0x8 |
EQUALITY NEURON | 0xF if A == B , else 0x0 |
1001 |
0x9 |
NO-OP / NULL | Always returns 0x0 |
1010 |
0xA |
SIGN BIT AGREEMENT | 1 if A[3] ^ B[3] is 1 , else 0 |
1011 |
0xB |
SIGMOID-LIKE | Returns 0x8 if 2 < A < 13 , else 0x0 |
1100 |
0xC |
FIRE ON DIFFERENCE | 0xF if A > B and (A - B) > 2 , else 0x0 |
1101 |
0xD |
BITWISE WEIGHTED SUM | Weighted sum: A[3]*4 + A[2]*3 + A[1]*2 + A[0]*1 |
1110 |
0xE |
QUADRATIC NEURON | (A * A + B) % 16 |
1111 |
0xF |
BINARY CLASSIFICATION | 1 if A > B , else 0 |
List external hardware used in your project (e.g. PMOD, LED display, etc), if any
# | Input | Output | Bidirectional |
---|---|---|---|
0 | a[0] | result[0] | opcode[0] |
1 | a[1] | result[1] | opcode[1] |
2 | a[2] | result[2] | opcode[2] |
3 | a[3] | result[3] | opcode[3] |
4 | b[0] | Error flag | Mode bit for ALU/NPU |
5 | b[1] | Sign flag | |
6 | b[2] | Carry flag | |
7 | b[3] | Zero flag |