All Projects → jb3 → cpu_emulator

jb3 / cpu_emulator

Licence: MIT license
LMC emulator written in Rust

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to cpu emulator

SherwoodArch
The Sherwood Architecture is a custom 64-Bit RISC based CPU architecture.
Stars: ✭ 13 (-59.37%)
Mutual labels:  cpu, cpu-emulator
Z80
Highly portable Zilog Z80 CPU emulator written in ANSI C
Stars: ✭ 131 (+309.38%)
Mutual labels:  cpu, cpu-emulator
asitop
Perf monitoring CLI tool for Apple Silicon
Stars: ✭ 1,197 (+3640.63%)
Mutual labels:  cpu
CoinHive
A nice friendly simple and easly customizable GUI for coinhives javascript miner to embed onto websites so users of your site can interact with features of the miner on every single page this javascript miner is to help those who have problems with advertisements/advertising/ads popups banners mobile redirects malvertising/malware etc and provid…
Stars: ✭ 58 (+81.25%)
Mutual labels:  cpu
ROIcoin
ROI Coin "ROI Coin Is Different"
Stars: ✭ 16 (-50%)
Mutual labels:  cpu
tree-core-cpu
A series of RISC-V soft core processor written from scratch. Now, we're using all open-source toolchain( chisel, mill, verilator, NEMU, AM and difftest framework, etc) to design and verify.
Stars: ✭ 22 (-31.25%)
Mutual labels:  cpu
computer-organization-lab
中山大学计算机组成原理实验 (2018 秋):用 Verilog 设计并实现的简易单周期和多周期 CPU
Stars: ✭ 45 (+40.63%)
Mutual labels:  cpu
HTGS
The Hybrid Task Graph Scheduler API
Stars: ✭ 36 (+12.5%)
Mutual labels:  cpu
coretemp
Outputs current CPU core and package temperatures on macOS.
Stars: ✭ 36 (+12.5%)
Mutual labels:  cpu
Bearcat captcha
熊猫识别不定长验证码,基于tensorflow2.2(tensorflow2.3也可以运行)轻松就能练出不错的模型
Stars: ✭ 67 (+109.38%)
Mutual labels:  cpu
indicium
Portable, advanced system information utility
Stars: ✭ 46 (+43.75%)
Mutual labels:  cpu
em400
MERA 400 emulator
Stars: ✭ 36 (+12.5%)
Mutual labels:  cpu
nodejs
Node.js in-process collectors for Instana
Stars: ✭ 66 (+106.25%)
Mutual labels:  cpu
cpu monitor
ROS node that publishes all nodes' CPU and memory usage
Stars: ✭ 52 (+62.5%)
Mutual labels:  cpu
hardware
Get CPU, Memory and Network informations of the running OS and its processes
Stars: ✭ 70 (+118.75%)
Mutual labels:  cpu
kotary
Managing Kubernetes Quota with confidence
Stars: ✭ 85 (+165.63%)
Mutual labels:  cpu
ncnn-android-benchmark
ncnn android benchmark app
Stars: ✭ 78 (+143.75%)
Mutual labels:  cpu
ARMStrong
A fast and simple ARM Simulator made for education based upon Unicorn and Keystone engines
Stars: ✭ 99 (+209.38%)
Mutual labels:  cpu
BenEaterVHDL
VHDL project to run a simple 8-bit computer very similar to the one built by Ben Eater (see https://eater.net)
Stars: ✭ 30 (-6.25%)
Mutual labels:  cpu
SilentCryptoMiner
A Silent (Hidden) Free Crypto Miner Builder - Supports ETH, ETC, XMR and many more.
Stars: ✭ 547 (+1609.38%)
Mutual labels:  cpu

CPU Emulator

Simple CPU emulator written in Rust

The instruction set implemented in this program is from this page (only difference is that STO is STA).

Instruction list

Name Code Opcode Definition
Load LDA XY 1XY Load the memory address of XY into the accumulator
Store STA XY 2XY Store accumulator value in memory address XY
Add ADD XY 3XY Add value of memory address XY to accumulator
Subtract SUB XY 4XY Subtract the value of memory address XY from accumulator
Input IN 500 Take user input and store in accumulator
Output OUT 600 Write value of accumulator to shell
Halt HLT 700 Halt execution of the program
Set SET XY 8XY Set the loaded memory address (loaded via LDA) to the memory address of XY
Jump JMP XY 9XY Change the program counter to memory address XY
Call CALL LABEL N/A This instruction internally changes into a JMP XY call to jump to a label.

Example programs

Add two numbers

MAIN:
	CALL GETINPUTS
    CALL ADDNUMS
    CALL PRINTOUT

GETINPUTS:
	IN
	STA 50
	IN
	STA 51

ADDNUMS:
	LDA 50
	ADD 51
	STA 52

PRINTOUT:
	LDA 52
	OUT
	HLT

Subtract one number from another

MAIN:
	CALL GETINPUTS
    CALL SUBTRACT
    CALL PRINTOUT

GETINPUTS:
	IN
	STA 50
	IN
	STA 51

SUBTRACT:
	LDA 50
	SUB 51
	STA 52

PRINTOUT:
	LDA 52
	OUT
	HLT

Infinite get input & print loop

MAIN:
	CALL LOOP

LOOP:
	IN
	OUT
	CALL LOOP

Pre-defining data

MAIN:
	LDA 50
	ADD 51
	OUT
	HLT

50 DAT 10
51 DAT 11

The above code means that at address 50, the number 10 will be stored, and at address 51, the number 11 will be stored. Upon execution 50 will be loaded into the accumulator, 51 will then be added to the accumulator and the accumulator will be outputted. Followed by a halt instruction.

Execution

  1. Build the binaries
  2. ./path/to/binary --compile source.file target.file
  3. ./path/to/binary --run target.file
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].