Git Product home page Git Product logo

pc-sim's Introduction

PC-Sim

This project is an abstraction of a computer’s data path design using object-oriented programming in C with supporting GIMP Toolkit (GTK+ 3) libraries to simulate the fetch-decode-execute cycle of an assembled program using the LC-2200 Instruction Set Architecture (ISA). The LC-2200 ISA supports RISC-style instructions with four types of addressing modes (R-type, I-type, J-type, and O-type) and eight different instructions: add, nand, addi, lw, sw, beq, jalr, and nop. The register-oriented 32-bit single-bus data path design contains five main components to support the CPU: memory, ALU, register file, program counter (PC), and instruction register (IR). These components serve as vehicles to carry out the simple instructions specified in the LC-2200 ISA to cater the needs of any high-level language.

External Resources

What do I need?

Be sure to set environment variable paths for these programs to link libraries (windows)

Environment Variables

C:\MinGW\bin
C:\MinGW\gtk\include\gtk-3.0\gdk
C:\MinGW\gtk\bin
C:\MinGW\pkg-config-lite\bin
C:\MinGW\gtk\lib\gmodule-2.0

How to operate?

  1. (if modifying src only) download MinGW (gcc compilier) and pkg-config-lite (helper tool used for easy compiling -extract folder inside C:\MinGW as "pkg-config-lite"), install GTK (place inside C:\MinGW name folder as "gtk") edit system environment variables stated above.
  2. clone repo.
  3. run gui.exe in src/assembler.
  4. copy text from official_test1.txt into assembler gui text area (an example assembly program) or load an assembly file from your hard drive.
  5. click 'assemble' menu_item.
  6. save assembly file to desktop or a location on a preferred drive.
  7. launch gui.exe in src/simulator
  8. open file menu, click 'load' menu item.
  9. navigate to assembled program and select it.
  10. press 'F5' to execute program instructions line-by-line
  11. repeat process from step 4, except now right your own assembly program using the LC-2200 ISA.

Batch File

Links C modules to accomodate easy compile line execution (only needed if modifying source code)

 
@echo off
 
set gtk_ver=gtk+-3.0
pkg-config %gtk_ver% --cflags --libs gmodule-2.0>tmp.txt
set /p pkg-info= <tmp.txt
del tmp.txt
 
rem echo %pkg-info%
cd src
gcc simulator/main.c simulator/simulator.c simulator/menubar.c simulator/registerlist.c simulator/instructionlist.c simulator/helper.c model/alu.c model/controlunit.c model/memory.c model/regfile.c -o simulator/gui.exe -Wall %pkg-info%
cd simulator
gui.exe
cd ..

Assembler

asm

Simulator

sim

pc-sim's People

Contributors

hlaw6809 avatar hlawrence6809 avatar nhays89 avatar nnebp avatar something43234523454325 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.