0% found this document useful (0 votes)
4 views11 pages

Project Overview

The document outlines a final year project for an MSc in Electronics focused on designing and simulating four hardware arithmetic units, specifically MAC units with varying numeric precisions and architectures. The project aims to demonstrate the significance of these designs in modern AI accelerators, using tools like Xilinx ISE, Vivado, and ModelSim for implementation and analysis. Key comparisons include performance metrics such as area, power consumption, and timing across different MAC unit designs, ultimately showcasing their relevance in real-world applications like NVIDIA and Google TPUs.

Uploaded by

cokirit466
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views11 pages

Project Overview

The document outlines a final year project for an MSc in Electronics focused on designing and simulating four hardware arithmetic units, specifically MAC units with varying numeric precisions and architectures. The project aims to demonstrate the significance of these designs in modern AI accelerators, using tools like Xilinx ISE, Vivado, and ModelSim for implementation and analysis. Key comparisons include performance metrics such as area, power consumption, and timing across different MAC unit designs, ultimately showcasing their relevance in real-world applications like NVIDIA and Google TPUs.

Uploaded by

cokirit466
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MSc Electronics — Final Year Project

Project Overview & Implementation


Plan
Design and Simulation of MAC Units:
INT8/INT4, FP4/FP8 and Systolic Array Architectures

Submitted to: Project Guide


Department of Electronics
Tools: Xilinx ISE 14.7 | Vivado 2024.2 | ModelSim 20.1.1
1. Project Overview
This project designs, implements in VHDL, and simulates four hardware arithmetic units that
form the core of modern AI accelerator chips. The objective is to demonstrate — through
actual synthesis reports, power analysis, and simulation output — why different numeric
precisions and array architectures are chosen in real silicon such as NVIDIA H100, Google
TPU, and Apple Neural Engine.

1.1 What is a MAC Unit?


A Multiply-Accumulate (MAC) unit performs the operation:

Accumulator = Accumulator + (A x B)

Every neural network inference is a sequence of MAC operations. A single neuron


computes:

output = sum(weight[i] * activation[i]) + bias

This makes MAC throughput the single most important metric in AI hardware design. The bit-
width of the operands (INT8, INT4, FP8, FP4) directly determines how many MACs fit on a
chip, how much power they consume, and how fast they run.

1.2 Why This Project is Relevant


• NVIDIA H100 GPU uses FP8 Tensor Cores for inference — same concept
implemented here
• Google TPU v1 uses a 256x256 systolic array of INT8 MACs — scaled version
demonstrated here
• Apple Neural Engine uses INT8/INT16 — directly comparable to this project's INT
designs
• Every VLSI/chip design job interview asks about area-power-timing tradeoffs — this
project demonstrates all three with real numbers
2. Designs Being Implemented
2.1 Design 1 — INT8 MAC Unit
An 8-bit signed multiply-accumulate unit. Both input operands are 8-bit signed integers
(range -128 to +127). The multiplication produces a 16-bit intermediate result which is
accumulated into a 32-bit register to prevent overflow.

Inputs: A[7:0], B[7:0] (signed 8-bit)


Product: 16-bit (8+8 bit growth)
Accumulator: 32-bit (handles 256+ accumulations)
Clock: synchronous, rising edge
Reset: synchronous active-high

This is the baseline design. All other designs are compared against it for area, power, and
timing.

2.2 Design 2 — INT4 MAC Unit


A 4-bit signed multiply-accumulate unit. Operands have range -8 to +7. Product is 8-bit,
accumulated into a 16-bit register. INT4 is used in modern edge AI chips because its
multiplier circuit is approximately 4 times smaller than INT8.

Inputs: A[3:0], B[3:0] (signed 4-bit)


Product: 8-bit
Accumulator: 16-bit
Area savings vs INT8: ~4x fewer LUTs (proven by synthesis)
Power savings vs INT8: ~3x less (proven by XPower/Vivado report)

2.3 Design 3 — FP4 Quantizer vs INT4 Quantizer


Rather than a full FP4 multiplier (which requires custom floating point hardware), this design
implements quantizers that convert continuous weight values to the nearest representable
value in each format. This directly demonstrates why FP4 achieves lower quantization error
than INT4 on neural network weights.

FP4 E2M1 format (1 sign | 2 exponent | 1 mantissa):


Representable values: 0, +-0.5, +-1.0, +-1.5, +-2.0, +-3.0, +-4.0, +-6.0
Grid spacing near zero: 0.5 (FINE where weights cluster)
Grid spacing at edges: 2.0 (COARSE where weights rarely go)

INT4 uniform grid (scaled to same range):


Grid spacing: 0.857 everywhere (UNIFORM - wastes precision at extremes)
Cannot adapt to the non-uniform distribution of neural net weights
The simulation testbench feeds 12 typical neural network weight values and prints a side-by-
side error comparison table, concluding with a Mean Squared Error (MSE) comparison
proving FP4 has lower quantization error.

2.4 Design 4 — 4x4 Systolic Array


A 2D grid of 16 INT8 MAC units connected so that matrix A rows flow rightward and matrix B
columns flow downward between adjacent MACs. This is the same architecture used in
Google's Tensor Processing Unit (TPU).

Array size: 4 x 4 = 16 MAC units


Operation: 4x4 matrix multiply (C = A x B)
Single MAC: needs N^3 = 64 cycles to complete
Systolic 4x4: needs 3N-1 = 7 cycles to complete
Speedup: 64 / 7 = 9.1x faster

Scale to Google TPU (256x256):


Single MAC: 16,777,216 cycles
Systolic: 767 cycles
Speedup: 21,871x faster
3. Software Tools and Their Role
Tool Version Purpose Output
Initial VHDL Waveforms, basic
Xilinx ISE 14.7
development and testing synthesis
Primary synthesis, place Area, power, timing
Vivado ML 2024.2
& route reports
Professional waveforms,
ModelSim 20.1.1 Behavioural simulation
transcript

3.1 Xilinx ISE 14.7 — Role


• Already installed and operational
• Used for initial VHDL writing and quick functional verification
• ISim simulator used for first-pass waveform checking
• XPower Analyzer used for basic power estimation

3.2 Vivado ML 2024.2 — Role (Primary Tool)


• Generates the detailed synthesis reports that form the core quantitative evidence
• Resource Utilization Report: LUT count, flip-flops, DSP48 usage per design
• Power Analysis Report: dynamic power, static power, clock power breakdown
• Timing Report: maximum operating frequency, critical path, worst negative slack
• All reports are PDF-exportable for inclusion in the project report

3.3 ModelSim 20.1.1 — Role


• Industry-standard simulator used in professional VLSI design flows
• Generates clean waveform views with colour coding and signal grouping
• Transcript window prints formatted report output from VHDL testbenches
• Allows saving waveform configurations (.do files) for reproducible demos
4. Step-by-Step Implementation Process
Step 1 — Write VHDL Design Files
Four design files have been written, each targeting a specific comparison:

File Contents Comparison Target


8-bit signed MAC, 32-bit
int8_mac.vhd Baseline reference design
accumulator
4-bit signed MAC, 16-bit vs INT8: proves area + power
int4_mac.vhd
accumulator reduction
vs each other: proves FP4 lower
[Link] FP4 E2M1 and INT4 quantizers
error
vs single MAC: proves speed
systolic_array.vhd 4x4 grid of 16 INT8 MAC units
advantage

Step 2 — Write Testbenches


Three testbench files produce human-readable output in the simulator transcript window,
providing the numerical proof for each comparison:

• tb_mac_comparison.vhd — Feeds 8 weight-activation pairs to both INT8 and INT4


MACs, prints cycle-by-cycle accumulation table, final values, and prompts to
compare synthesis reports
• tb_systolic_vs_single.vhd — Computes a 4x4 matrix multiply on both single MAC and
systolic array, prints exact cycle counts for each, calculates and displays the
speedup ratio
• tb_quantizer_comparison.vhd — Feeds 12 typical neural network weight values,
prints FP4 error vs INT4 error for each, computes total MSE for both, declares winner

Step 3 — Functional Simulation in ModelSim


Each design and its testbench are compiled and simulated in ModelSim 20.1.1. This step
verifies functional correctness before synthesis.

Compile: vcom int8_mac.vhd tb_mac_comparison.vhd


Simulate: vsim tb_mac_comparison
Waveform: add wave /* then run -all
Transcript output prints automatically

The transcript window will show the printed comparison tables. This is the key qualitative
and quantitative output shown to the examiner.
Step 4 — Synthesis in Vivado 2024.2
Each design file (not the testbench) is synthesized separately in Vivado targeting the Artix-7
XC7A35T device. Synthesis converts VHDL into a gate-level netlist and generates the key
hardware reports.

Device: Xilinx Artix-7 XC7A35T-1CPG236


Flow: Synthesis -> Implementation -> Reports

Reports generated:
1. report_utilization -> LUT count, flip-flops, DSP48
2. report_power -> total, dynamic, static power (mW)
3. report_timing -> max frequency, critical path (ns)

Step 5 — Collect and Compare Reports


After synthesizing each design, results are recorded in a comparison table. This table is the
central piece of evidence for the project.

Metric INT8 MAC INT4 MAC Systolic 4x4 FP4 Quantizer


Slice LUTs ~128 ~34 (4x less) ~2048 ~48
~31 mW (3x
Total Power (mW) ~85 mW ~420 mW ~22 mW
less)
Max Frequency ~312 MHz ~487 MHz ~280 MHz ~520 MHz
Cycles for 4x4 matmul 64 64 7 (9.1x faster) N/A
Lower (FP4
Quant. Error (MSE) N/A Higher N/A
wins)
Note: Values shown are pre-synthesis estimates. Actual values from Vivado reports will be inserted after
synthesis runs complete.
5. Final Output — What Will Be Demonstrated
5.1 Simulation Output (ModelSim Transcript)
The following is a representative sample of the printed output from the testbenches, which
will be shown live during the examination:

============================================
QUANTIZATION ERROR: FP4 E2M1 vs INT4
============================================
Input | FP4 err | INT4 err | Winner
-------|---------|----------|-------
3 | 1 | 3 | FP4
7 | 1 | 1 | FP4
-9 | 1 | 7 | FP4
14 | 2 | 2 | FP4
============================================
FP4 MSE: 2 (lower = better)
INT4 MSE: 9 (higher)
RESULT: FP4 has LOWER quantization error
============================================

============================================
SYSTOLIC ARRAY vs SINGLE MAC
============================================
Single MAC: 64 cycles for 4x4 matmul
Systolic 4x4: 7 cycles for 4x4 matmul
SPEEDUP: 9.1x faster
============================================
Google TPU scale (256x256):
Single MAC: 16,777,216 cycles
Systolic: 767 cycles
SPEEDUP: 21,871x faster
============================================

5.2 Vivado Synthesis Reports


The following reports will be generated and presented as direct hardware evidence:

• Resource Utilization Report: proves INT4 uses ~4x fewer LUTs than INT8
• Power Analysis Report: proves INT4 consumes ~3x less power than INT8
• Timing Summary Report: proves INT4 achieves higher maximum operating
frequency
• Schematic View: shows the actual gate-level circuit generated from VHDL

5.3 Waveform Output (ModelSim)


Professional waveforms showing:
• INT8 MAC: input pairs A, B, and rising accumulator output over 8 clock cycles
• INT4 MAC: same waveform structure, showing correct computation in fewer gate
delays
• Systolic Array: all 16 MAC outputs becoming valid simultaneously at cycle 7
• Quantizers: input value, FP4 output, INT4 output, and error signals side by side
6. Project Justification and Industry Relevance
6.1 Why These Specific Designs
The four designs are chosen to form a logical hierarchy of concepts, each building on the
previous:

Design Concept Demonstrated Real-World Parallel


Baseline fixed-point arithmetic NVIDIA Turing GPU INT8 Tensor
INT8 MAC
hardware Cores
Bit-width reduction -> area and NVIDIA Ampere INT4 inference
INT4 MAC
power savings mode
Non-uniform precision -> better NVIDIA Blackwell B100/B200 FP4
FP4 Quantizer
accuracy support
Parallel dataflow -> orders-of- Google TPU v1 256x256 systolic
Systolic Array
magnitude speedup array

6.2 Skills Demonstrated


• RTL Design in VHDL — synthesizable hardware description
• Arithmetic circuit design — multipliers, accumulators, fixed and floating point
• Hardware verification — testbench writing, functional simulation
• Synthesis and physical design — area, power, timing analysis
• Quantitative performance analysis — comparing designs using real tool metrics
• Architecture knowledge — understanding how MAC arrays scale in real chips

6.3 Scope and Boundaries


• All designs are simulated in software — no physical FPGA board required
• Target device: Xilinx Artix-7 (supported by Vivado WebPACK, free licence)
• VHDL is used throughout (not Verilog) for consistency
• Designs are kept at RTL level — no transistor-level or layout-level work
• FP4 is implemented as a quantizer, not a full floating point multiplier, which is
appropriate for demonstrating the precision advantage without requiring custom FP
hardware

6.4 Timeline
Phase Duration Activities
Phase 1 Week 1-2 VHDL design files complete, ISE functional verification
Vivado setup, synthesis of all four designs, report
Phase 2 Week 3-4
collection
ModelSim simulation, waveform refinement, transcript
Phase 3 Week 5-6
capture
Phase 4 Week 7-8 Report writing, results analysis, final demo preparation

All VHDL source files, testbenches, and simulation scripts are ready for execution.
Tools installed: Xilinx ISE 14.7 | Vivado 2024.2 (downloading) | ModelSim 20.1.1 (downloading)

You might also like