Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Binary Calculator

A low-level binary arithmetic calculator written in C++.

The project is designed to demonstrate how arithmetic can be built from the smallest logical building blocks: individual bits, logic gates, adders, and finally an arithmetic logic unit (ALU).

The main goal is not to create a practical calculator. The goal is to understand and implement the mechanics behind binary arithmetic instead of relying on C++'s built-in arithmetic operators for the actual calculations.


Project Status

The project is currently in the early implementation stage.

Implemented

  • Conversion from int to binary representation
  • Conversion from binary representation back to int

In Progress

  • Core Bit abstraction
  • Bitwise logic operations
  • Half Adder
  • Full Adder

Planned

  • Binary addition
  • Two's complement
  • Binary subtraction
  • Bit shifts
  • Binary multiplication
  • Binary division
  • ALU
  • Expression parser
  • Command-line calculator
  • Automated tests for every layer
  • Debug/trace mode showing calculations bit by bit

The checklist is intentionally kept in this README so the repository shows the actual development progress of the project.


Why This Project Exists

Modern C++ makes arithmetic trivial:

int result = 7 + 4;

This project deliberately goes underneath that abstraction.

The target is to make the following chain explicit:

number
  ↓
binary representation
  ↓
individual bits
  ↓
logic operations
  ↓
half adder
  ↓
full adder
  ↓
multi-bit adder
  ↓
ALU
  ↓
calculator

For example, instead of directly evaluating:

7 + 4 = 11

the program should eventually perform:

7  = 0111
4  = 0100

  0111
+ 0100
------
  1011

and only then convert 1011 back to decimal 11.


Learning Objectives

This project is primarily an exercise in understanding low-level computation.

It covers:

  • binary number representation,
  • bit manipulation,
  • boolean logic,
  • logic gates,
  • carry propagation,
  • adders,
  • two's complement arithmetic,
  • bit shifting,
  • multiplication and division algorithms,
  • ALU design,
  • abstraction boundaries in C++,
  • testing low-level components independently.

The final result should make it possible to follow a calculation from an integer input all the way down to individual bit operations.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages