Skip to content

CoffeeCoder1015/Circuit-city

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSE12 very cool circuit stuff

I got bored so I decided to take it further and write ALU instead.

First time learend about Ripple carry adders from a disgusting Advent of Code question that needed you to write a program to correct a broken ripple carry adder.

This stuff turned out to be very interesting and helpful in understanding certain arithmetic behavior in low level languages (e.g why the MSB indicates negative numbers comes from this circuit... well kind of, i mean I just learnt this stuff)

I WILL NOT BE ADDING IEE754 OF ANY KIND

Picture of the 8 Bit ALU

I decided to use bus splitters/joiners for input output to get a good experience when messing around with it.

alt text

My glorious masterpiece

Some notes on usage

A and B are input numbers where B is inverted during subtraction mode

$$f(A, B, \text{mode}) = \begin{cases} A + B, & \text{if mode = ADD} \\\ A - B, & \text{if mode = SUBTRACT} \\\ A B, & \text{if mode = MULTIPLY} \end{cases}$$

op is the switch between addition and subtraction and multiplication (0 is ADD, 1 is SUBTRACT, 2 is MULTIPLY, 3 is redundant but multiplies anyways)

c_i is for carry in which isn't really used

out_int is signed decimal output

out_uint is unsigned decimal output

About

I got bored so I made an ALU

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published