Simple Computer Simulation

As a test of the application code and to come up with a kind of boss level, I have been working out how to simulate a simple computer.

Although this is quite simple, I wanted it to be able to run assembly language code with a reasonable variety of instructions. So there is a program memory and a micro-instruction memory. Some simple computer designs only use one memory. Also, it is 8-bit.

Computer

Creating this highlighted a few things that could be simplified such as removing unused features such as OE and LD pins on devices.

I made some changes to an architecture design that I was basing it off where I removed Register B (to get 1 extra address bit) and expanded the ROM from 32 words to 64 words. This allowed for inclusion of conditional jumps using the ALU status flags and including AND, OR, and A-B functions of the ALU. Without these features it would have been too primitive to write meaningful programs I think.

Even with the expanded memory, I had to drop NOP and HALT instructions, which I hope is not a problem.

Here is a spreadsheet that I created to plan out the micro-instructions (these instructions control the signals to the circuit elements in a sequence to perform each assembly language instruction):

Instructions

For the conditional jumps, I make them affect one address line when the Jump instructions are addressed. This wastes some memory positions where each Jump consumes 8 memory addresses. So half of the ROM is taken by the conditional Jump code. And multiplexers are needed for the external logic.

Game Challenge

It will be interesting to have a game player create this kind of thing from scratch, and then run code on it. I will have to provide a lot of hints I think.

For sure, I will have to examine some really simple CPU architectures before players have to tackle this. These should have a single memory of 32 words and combine instruction and data/address into each word in the memory i.e. program the ROM with everything it needs to run its application.

Comments Forum

More Devlog entries

Most recent first