Close

Finalising the Instruction Set

A project log for Suite-16

Suite-16 is a 16-bit cpu built entirely from TTL. It is a personal exploration of how hardware and software interact.

monsonitemonsonite 11/04/2019 at 13:121 Comment

Recently, I have been exploring the Suite-16 instruction set, by the practical method of writing assembly language to run on the Suite-16 simulator.

Starting with a very simple routine to output "Hello World!", I have created routines for decimal and hexadecimal entry, decimal output and a very simple command interpreter.

In writing these routines, it became clear that there were certain deficiencies in the instruction set and over the last 2 weeks I have slowly added useful instructions to make the cpu more versatile.

This process is now approaching it's logical conclusion - partly because I have run out of spare instruction slots, and partly because I don't want to create such a complicated instruction set - that I don't stand a chance of implementing it in hardware. 

Also I feel that after 2 weeks of spare time writing assembly routines it's time to move the project along to its next phase and begin the hardware implementation.

There are three main areas in which I believe the instruction set can be augmented.  

The first is making more use of 16-bit immediate operations on the accumulator R0. To the ADI and SBI operations are 8-bit immediate operations where the operand is held in the lower 8 bits of the instruction register.  Extending this to 16-bit will mean that the operand will be held in the next location in memory.  This could be done by making the program counter another general purpose register - and this I believe is how the MSP430 implements immediate operations.

With this mechanism in place, ADD, SUB, AND, OR and XOR would benefit from having this 16-bit immediate mode.

My dealings with the decimal and hex routines have also highlighted the need for an efficient left shift on the accumulator.  

Ideally I can implement as a bare minimum an ADD R0, R0, which will at least allow a doubling of the accumulator without involving any other register.  The "Times 10" and "Times 16" routines used in decimal and hexadecimal entry would benefit from this instruction saving a few instruction cycles.

Secondly,  I'm proposing that the 8-bit payload in the lower 8 bits of the instruction register can be used as an address to allow the IN and OUT operations to address up to 256 I/O devices.  This is a placeholder for memory mapped I/O peripherals such as UARTs, timers and GPIO which can be added later.

Thirdly, the final instruction slot 0x0Fxx which is currently used as NOP. I intend to extend this to allow for microinstructions - inspired by the OPR, "OPeRate" instructions used on the PDP-8. 

Plagiarising the PDP-8

The OPR instructions allow operations such as clearing and complementing the accumulator, setting and clearing the carry bit and shift and SWAP operations to be implemented.

The PDP-8 OPR instructions were implemented with the following individual bit-lines that operated directly on the hardware:

This scheme gives access to 8 individual control lines which could be sequenced to become active in a specific timeslot which allowed quite complex operations to be performed on the accumulator.

An alternative scheme is possible, where the lower 8-bit payload are fully decoded to allow up to 256 microinstructions.  For maximum flexibility this could be done by using the byte to address a micro instruction ROM such as an additional  AT27C1024.  A 4-bit counter can be used on higher address lines to provide a primitive 16 step microsequencer.  That leaves 4 address lines which could be used as inputs to implement a simple external interrupt system.

This would be very flexible but requiring more hardware, and probably quite limited by the access time of the AT27C1024 ROM.

The next plog (project log) will start to look at the hardware architecture and how we might implement a fast microinstruction sequencer using a counter, a diode matrix and some 3-8 line decoders.

Discussions

roelh wrote 11/04/2019 at 22:12 point

Hi Monsonite

The PDP-8 OPR instructions were helpful for the PDP-8 because the PDP-8 had only very few native instructions. But I think in your case almost everything that OPR can do is already covered by existing instructions. One use of OPR was composing small constants, I think you could add a MOV-8-bit-immediate for that. And using a ROM for this is against your 'no-microcode' philosophy. If you are going to use a ROM, it would be more flexible to use it for all instructions instead of for OPR only.

You are of course free to change your design and its philosophy any time, just wanted to tell you that your design with OPR added seems unbalanced to me.

And if you still want (partly ?) hardwired decoding, it is good to start drawing schematics because that will give you a feeling how easy or difficult it is to implement your ISA. You might then decide to change the ISA for easier decoding.

  Are you sure? yes | no