Computer Add Demo Code
0 Stars     52 Views    

Author: Sanderokian Stfetoneri

Forked from: Sanderokian Stfetoneri/Computer Add Auto

Project access type: Public

Description:

A Computer. Kind of.

The 256-Series, my new collection of simulated computers: https://circuitverse.org/users/4699/projects/256-series

This version is setup to demonstrate a program that adds two numbers together. This version has been specifically modified to make demonstrating the program easier. This was done by making operand A for the first two instructions depend on user input, which allows the user to easily test the program with different values. 

The code is as follows:

00: LOAD Input A into Address 00

01: LOAD Input B into Address 01

02: ADD Addresses 00 and 01

03: LOAD ADD Result into 02

04: RETURN Address 02

Features:

32-Bits of 5-bit RAM,

32 Lines for Instructions,

ADD, AND and XOR Functions.

Go To Functionality

Can do IF = Statements

OP Codes:

0000 = Nothing

0001 VVVVV AAAAA = LOAD VVVVV into address AAAAA

0010 AAAAA 00000 = LOAD Add result into address AAAAA

0011 DDDDD VVVVV = ADD DDDDD and VVVVV together

0100 AAAAA BBBBB = ADD address AAAAA and address BBBBB together

0101 DDDDD VVVVV = AND DDDDD and VVVVV together

0110 AAAAA BBBBB = AND address AAAAA and address BBBBB together

0111 DDDDD VVVVV = XOR DDDDD and VVVVV together

1000 AAAAA BBBBB = XOR address AAAAA and BBBBB together

1001 AAAAA 00000 = LOAD AND result into address AAAAA

1010 AAAAA 00000 = LOAD XOR result into address AAAAA

1011 AAAAA 00000 = GOTO address AAAAA (in instruction memory) 

1100 AAAAA BBBBB = If add result = 0 (ignoring carry), GOTO address AAAAA else go to address BBBBB (in instruction memory)

1101 VVVVV 00000 = Return VVVVV (Stops the program)

1110 AAAAA 00000 = Return the value at address AAAAA (Stops the program)

1111 = Nothing

Created: Sep 30, 2021

Updated: Aug 26, 2023


Comments

You must login before you can post a comment.