This repository contains MATLAB implementations of fundamental digital logic components used in the design of CPUs. These components are based on principles from digital logic design and the book The Elements of Computing Systems (also known as Nand2Tetris).
The following digital logic modules are implemented:
Nand.m- NAND gateNor.m- NOR gateNot.m- NOT gateXor.m- XOR gateXnor.m- XNOR gate
Mux2.m- 2-to-1 MultiplexerMux4.m- 4-to-1 MultiplexerMux8.m- 8-to-1 Multiplexer
Demux2.m- 1-to-2 DemultiplexerDemux4.m- 1-to-4 DemultiplexerDemux8.m- 1-to-8 Demultiplexer
HalfAdder.m- Half AdderFullAdder.m- Full Adder
This project was developed as an academic assignment to understand the inner workings of CPU components using MATLAB. The goal is to simulate and visualize basic hardware-level computations in a high-level programming environment.
- Open MATLAB.
- Clone or download this repository.
- Navigate to the folder in MATLAB's working directory.
- Run any script using the command window. For example:
output = Mux4([1; 0; 1; 0], [1; 0])