Close

Condition codes

A project log for Gigatron TTL microcomputer

Just because! A home computer without microprocessor

marcel-van-kervinckMarcel van Kervinck 04/23/2017 at 21:005 Comments

During jump, the ALU is wired to calculate "-AC". Only the carry out is looked at. The negation result itself is not used and discarded.

What's the use of this? Well, only in case of all-zero bits, "-AC" overflows the ALU, setting its carry-out line. So in this case the carry out acts as a zero indicator (Z). If we also look at bit 7 of AC, we also know if AC is negative or positive. The combination of these two signals makes all condition codes possible:

With this, a single 74153 chip can decode the condition code from the opcode, compare it to the contents of AC, and determine if a jump is needed.

Discussions

Yann Guidon / YGDES wrote 06/05/2017 at 01:15 point

Hey it's funny because, instead of "far jump" I use one "useless" condition code to select the "CALL" instruction in the #YGREC-РЭС15-bis :-)

  Are you sure? yes | no

Marcel van Kervinck wrote 06/05/2017 at 10:09 point

Interesting! Note that I only updated the table formatting in this older blog. I couldn't make the site's own tables look good, so it is now replaced with a screenshot from excel.

Every time I look at this part of the design, I have the feeling a magician performs a trick in front of my eyes. But then I get extra confused when I realise the magician is me. In fact, I didn't believe it would work out, thinking I must have overlooked something, until the conditional jumps proved themselves on the breadboard.

  Are you sure? yes | no

Yann Guidon / YGDES wrote 06/05/2017 at 10:18 point

yeah that's the pleasure of designing CPUs :-)

I came up with the 24 bits opode-less instructions of the YGREC in the bath :-D

The fact that we converge on this type of design means that we must be touching some kind of more universal truth...

"My" condition codes are Zero, Carry and Sign/MSB (I'd like to add LSB/parity but it's less used and wastes a bit) and many other CPU use 3 bits for condition. There is the "Always/Never" dilemma, should "never" be reserved for instruction expansion like in ARM ? We both chose to use it for a better, immediate purpose where it makes sense :-)

  Are you sure? yes | no

Yann Guidon / YGDES wrote 04/23/2017 at 21:14 point

is the table badly formatted ?

  Are you sure? yes | no

Marcel van Kervinck wrote 04/23/2017 at 21:49 point

Unfortunately it doesn't excel.

  Are you sure? yes | no