MCP ExplorerExplorer

Mcpu Ext

@AranweLTTon 10 months ago
2 MIT
FreeCommunity
AI Systems
Indirect memory adressing version of the MCPU 8 bit CPU

Overview

What is Mcpu Ext

mcpu-ext is an indirect memory addressing version of the MCPU 8-bit CPU, featuring a complete overhaul of the VHDL implementation for explicit control lines logic expressions.

Use cases

Use cases include developing educational tools for learning CPU design, simulating CPU operations for research purposes, and building custom computing systems for personal projects.

How to use

To use mcpu-ext, clone the repository and follow the instructions in the README for setting up the Python assembler and simulator.

Key features

Key features include indirect memory addressing, a comprehensive instruction set, and a detailed memory map that supports various memory areas.

Where to use

mcpu-ext can be used in educational settings for teaching computer architecture, in research for CPU design, and in hobbyist projects involving custom CPU implementations.

Content

MCPU Extended Adressing

This is a indirect memory adressing version of the MCPU 8 bit CPU, and total overhauled VHDL implementation for explicit control lines logic expressions.

Github
Python

Original MCPU: https://github.com/cpldcpu/MCPU

Table of Contents
  1. Architecture
  2. Getting started
  3. Licence

Architecture

Instruction set:

Mnemonic Opcode Description
NOR 00AAAAAA Accu = Accu NOR mem[mem[AAAAAA]]
ADD 01AAAAAA Accu = Accu + mem[mem[AAAAAA]], update carry
STA 10AAAAAA mem[mem[AAAAAA]] = Accu
JCC 11DDDDDD Set PC to DDDDDD when carry = 0, clear carry

Memory map:

Address Area Size
0x0000 Program memory 256 bytes
0x00FF
0x0100 Vector table 64 bytes
0x010F
0x0110 General purpose memory 192 bytes
0x01FF

Getting started

Start by cloning this repository.

git clone 'https://github.com/AranweLTT/mcpu-ext.git'

No specific python requirements are needed.

Python assembler

python assembler.py <input_file> <output_file>

Using the Python simulator

python emu.py <input_file> <n_cycles>

The input file is the compiled program (.obj) file, not the assembly code.

The output for the first 14 cycles of the prime test program should be as follows (assembly listing in assembler/prime.asm) :

pc,ir,acc,cf:	00	0x01	  0	0
pc,ir,acc,cf:	01	0x43	  0	0
pc,ir,acc,cf:	02	0x01	  2	0
pc,ir,acc,cf:	03	0x41	  0	0
pc,ir,acc,cf:	04	0x41	255	0
pc,ir,acc,cf:	05	0x84	254	1
pc,ir,acc,cf:	06	0x01	254	1
pc,ir,acc,cf:	07	0x45	  0	1
pc,ir,acc,cf:	08	0x44	  3	0
pc,ir,acc,cf:	09	0xc9	  1	1
pc,ir,acc,cf:	10	0xc8	  1	0
pc,ir,acc,cf:	08	0x44	  1	0
pc,ir,acc,cf:	09	0xc9	255	0
pc,ir,acc,cf:	11	0x00	255	0
pc,ir,acc,cf:	12	0x44	  0	0
pc,ir,acc,cf:	13	0x42	254	0

A special feature of the simulator is that instruction 0xFF will print out the content of the accumulator. Therefore if the program is long, and the number of cycles greater than 100, this will be the only output.

Licence

MCPU original Licence

SMAL license:

/* smal32.c   language: C
   copyright 1996 by Douglas W. Jones
                     University of Iowa
                     Iowa City, Iowa  52242
                     USA

   Permission is granted to make copies of this program for any purpose,
   provided that the above copyright notice is preserved in the copy, and
   provided that the copy is not made for direct commercial advantage.

   Note: This software was developed with no outside funding.  If you find
   it useful, and especially if you find it useful in a profit making
   environment, please consider making a contribution to the University
   of Iowa Department of Computer Science in care of:

                     The University of Iowa Foundation
                     Alumni Center
                     University of Iowa
                     Iowa City, Iowa  52242
                     USA
*/

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers