Skip to content

Repository files navigation

Computer Internals simulator in Go

This project simulates the internals of a compiler and a von Neumann architecture computer, complete with a CPU, memory, ASSEMBLER, LEXICAL PARSER among others. The system is written in Go and flex

The goal of this project is to better understand the fundamentals of computer systems

Features

  • Custom binary language instruction set
  • CPU that understands those instructions
  • Memory and register management
  • Custom assembler for it
  • Lexical parser

Usage

Assuming you have both flex, go, and an initial input on a .txt file. Just run the makefile

make

To avoid some unwanted warning. The input.txt file must end on LR instead of CRLF

Instruction Set

Here’s the complete list of supported instructions:

CodeInstructionInput 1Input 2
00000BEGINN/AN/A
11111ENDN/AN/A
00001LOADDestiny RegisterConst
00010STOREDestiny Memory DirectionRegister
00011MOVEDestiny RegisterOrigin Register
00100LOADDISKDestiny RegisterOrigin Memory Direction
00101ADDRegister 1Register 2
00110SUBRegister 1Register 2
00111MULTRegister 1Register 2
01000DIVRegister 1Register 2
01001MODRegister 1Register 2
01010ANDRegister 1Register 2
01011ORRegister 1Register 2
01100XORRegister 1Register 2
01101NOTRegister 1Register 2
01110LEFSHIFTRegister 1Bit ammount
01111RIGHTSHIFRegister 1Bit ammount

About

Building a computer from scratch

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages