Skip to content

divy3988/4-Bit-ALU

Repository files navigation

4-Bit Arithmetic Logic Unit (ALU)

This project implements a 4-bit Arithmetic Logic Unit (ALU) in Verilog, designed to perform basic arithmetic and logical operations. The project also includes a SPICE netlist for simulation and verification of the ALU's behavior.


Features

  1. Arithmetic Operations

    • 4-bit addition
    • 4-bit subtraction
  2. Logical Operations

    • NAND
    • XOR
  3. Outputs

    • 4-bit result
    • Carry-out for addition
    • Borrow-out for subtraction

Project Files

1. Verilog Implementation

  • File: 4BitALU.v
  • Description: Verilog module implementing the 4-bit ALU, with 2-bit selection lines to control the operation and dedicated outputs for carry and borrow.

2. SPICE Netlist

  • File: 4bitalu.netlist.cir
  • Description: SPICE netlist describing the transistor-level implementation of the 4-bit ALU for circuit simulation.

Usage

Verilog Simulation

  1. Use any Verilog simulation tool such as ModelSim or Xilinx Vivado.
  2. Simulate the ALU module with various input combinations to verify its functionality.

SPICE Simulation

  1. Use any SPICE simulation software (e.g., LTSpice, HSPICE).
  2. Load the .cir file to analyze the circuit's behavior at the transistor level.

Module Description

Verilog ALU

  • Inputs:
    • A[3:0]: First 4-bit operand
    • B[3:0]: Second 4-bit operand
    • sel[1:0]: Operation selector
  • Outputs:
    • result[3:0]: Result of the selected operation
    • carry_out: Carry-out for addition
    • borrow_out: Borrow-out for subtraction

SPICE Netlist

  • Includes subcircuits for essential components like inverters and full adders.
  • Defines the transistor-level design of the 4-bit ALU.

Simulation Instructions

Verilog Simulation

  • Modify the testbench to test specific operations.
  • Use waveform viewers to verify signal transitions and output correctness.

SPICE Simulation

  • Run transient and DC analyses to observe the circuit's behavior over time.
  • Validate the outputs of the ALU against expected results.

Future Improvements

  • Add more operations, such as AND, OR,Comparator and bit-shifting.
  • Optimize transistor-level design for power and area efficiency.

Author

This project showcases a detailed implementation of a fundamental digital component used in microprocessors. The design demonstrates both the logical and hardware-level aspects of a 4-bit ALU.

About

This project implements a 4-bit ALU for addition, subtraction, NAND, and XOR operations. Designed in Verilog with a SPICE netlist, it enables logic simulation and transistor-level analysis, ideal for studying digital circuit and microprocessor design.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors