Close

More condition codes

A project log for PDP - Processor Design Principles

Distilling my experience and wisdom about the architecture, organisation and design choices of my CPUs

yann-guidon-ygdesYann Guidon / YGDES 12/27/2018 at 09:360 Comments

Condition codes are notoriously bad. Log 21. Conditional execution and instructions doesn't even scratch the whole subject but my latest "trick" is worth a whole log.

During private discussions with @Drass about the memory granularity, I realised that unaligned access was probably handled in the YASEP with the wrong perspective. When doing an insertion or extraction of a 16-bits word in a 32-bits architecture, the instruction would set the Carry flag to indicate when the extracted sub-word overlaps the natural memory word boundary. This way the program can detect if/when more code must be executed to fetch the remaining byte from the next word.

It's a little harmless kludge but it works in theory. Unfortunately this is not scalable. This wouldn't work with #F-CPU  for example.


Enters 2018 and new insight.

My CPUs typically have the following condition codes or flags :

Today's unkludging is an extension of the parity bit : more bits are created that provide information about alignment  before the fact, unlike the IE method. It also simplifies the logic for carry generation (I don't know why I chose to modify this bit in particular, and not the Parity bit)

In summary:

This is "good" because:

The less nice part is the increased coding space required in the instructions, to hold 1 or 2 more codes.

Discussions