Skip to content

revanthgsr/4x4_bit_approx_mul

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

4x4 Bit Approximate Multiplier

This repository presents an approximation technique for a 4x4 bit multiplier based on the methods described in the paper Design and Analysis of Approximate Multipliers. The final implementation satisfies the following criteria:

  • Mean relative error: Less than 10%
  • Number of LUTs: Less than 12

Overview

Approximation Techniques

Half Adder

The exact half adder is approximated as follows:

  • Exact Implementation:
    • Sum = A $\oplus$ B
    • Cout = A $\cdot$ B
  • Approximated Implementation:
    • Sum = A $+$ B
    • Cout = A $\cdot$ B

ha

Truth Table Comparison

A B Exact Approximate
Sum Cout Sum Cout
1 1 0 1 1 1

1 out of 4 cases has an error in Sum.

Full Adder

The exact full adder is approximated as follows:

  • Exact Implementation:
    • Sum = A $\oplus$ B $\oplus$ Cin
    • Cout = (A $\cdot$ B) $+$ (B $\cdot$ Cin) $+$ (Cin $\cdot$ A)
  • Approximated Implementation:
    • Sum = B
    • Cout = A
    • Cin is not used.

fa

Truth Table Comparison

A B Cin Exact Approximate
Sum Cout Sum Cout
0 0 1 1 0 0 0
0 1 1 0 1 1 0
1 0 0 1 0 0 1
1 1 0 0 1 1 1

4 out of 8 cases have errors: 4 in Sum and 2 in Cout.

Partial Product Transformation

The approximation involves the transformation of partial product terms am,n and an,m ( am,n = a[m] $\times$ b[n] ) into propagate and generate terms:

  • pm,n = am,n $+$ an,m
  • gm,n = am,n $\cdot$ an,m
  • am,m terms are retained.

partial_product_transformation

Partial Product Reduction with Compressors

A compressor is used to simplify the partial product tree. It takes 4 input bits and a carry-in (Cin) bit and generates Sum, Carry, and Carry-out (Cout) bits. The exact compressor uses two full adders:

  1. The first full adder takes 3 input bits and generates:
    • Intermediate Sum
    • Carry-out (Cout)
  2. The second full adder takes:
    • Intermediate Sum
    • 4th input bit
    • Carry-in (Cin)
      and generates the final Sum and Carry bits.

exact_compressor

Approximated Compressor

The approximated compressor is defined as:

  • Carry = Cin
  • Sum = (A $\oplus$ B) $+$ (C $\oplus$ D)
  • Carry-out (Cout) = (A $\cdot$ B) $+$ (C $\cdot$ D)

compressor

Truth Table Comparison

A B C D Cin Exact Approximate
Sum Carry Cout Sum Carry Cout
00001 100 010
00011 010 110
00101 010 110
00110 010 001
00111 110 011
01001 010 110
01010 010 100
01100 001 100
01101 101 110
01111 011 111
10001 010 110
10010 010 100
10100 001 100
10101 101 110
10111 011 111
11001 101 011
11011 011 111
11101 011 111
11110 011 001
11111 111 011

20 out of 32 cases have errors: 16 in Sum, 8 in Carry and 6 in Cout.

partial_product_reduction
Half Adder: grey , Full Adder: blue , Compressor: dark_blue , Cout: orange & Carry: orange

The Cout for the last half adder is always 0.

Final Summation

After the partial product reduction, the remaining Sum and Carry-out bits are processed using half adders and full adders to generate the final output.


Results and Analysis

The following images demonstrate that the design meets the specified criteria for:

  1. Error: Mean relative error = 8.23% (less than 10%)

mean_relative_error = 8.23%

  1. Power Utilization: 40 mW for logic (Efficient power usage)

power = 40mW for logic

  1. LUT Utilization: Number of LUTs = 9 (less than 12)

utilisation = 9 LUTs


Feel free to clone this repository and explore the implementation!

About

This repo contains a verilog file which implements the design of a 4x4 bit approximate multiplier.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published