Close

Conditional execution and instructions

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 02/17/2018 at 23:280 Comments

Conditional execution is a cornerstone of even basic computing. This is required to even get near Turing-completeness.

There are two main ways to perform an operation when a condition is met.

  1. Conditional jump was the favorite way in the 70s : Motorola and Intel had the classic "branch" instructions, for example the "Jxx" in the 8086 that jumps +/-128 bytes
  2. Later, "predicated" instructions  had more exposure (notably in the ARM world)

Actually there is a whole spectrum of solutions and approaches in this subject. This small angle could help characterize a processor, besides the register width, register count, speed etc.

This is also because there are quite a few ways to get them done, and I'm not sure I could list them all. Many systems have been tested, look at the PIC16F family's skip instructions, or the RCA1802... I have very little familiarity with the POWER architecture, for example, which is a very elaborated system and I'll need to review it soon. All help is welcome, please submit your favorite weirdo :-)

For my part, starting with the #YASEP Yet Another Small Embedded Processor  and later expanded in the #YGREC8/#YGREC16 - YG's 16bits Relay Electric Computer , I use a mixed method: some instructions that need long literals are "plain", while those with many register fields have a few bits (4 to 7) to inhibit the instruction's result writeback. This is enough to get things done (particularly when PC is a register like the others) but I am conscious it can only work with microcontrollers.

The whole thing breaks apart for a superpipeline application processor... I am rethinking so much about this subject, pondering what would be the best way to implement the #F-CPU's FC1. For example, what's best for a tight pipeline ? "early selection" or "late selection" of the instruction's condition ? What should it affect ?

Discussions