9

I am looking at the machine code for the LGP-30, which is found to have a very strange instruction word layout.

  • 12 ignored bits
  • 4 bits for the opcode
  • 2 more ignored bits
  • 12 bits for the operand, consisting of:
    • 6 bits for the track,
    • 6 bits for the sector
  • another two ignored bits

Initially, since half the instruction word is wasted space, I thought there would be an opportunity to basically double the memory available to executable code. But, no such luck: some of these bits are ignored for reasons relating to the timing of the sequentially accessed memory. Like, maybe the two ignored bits directly after the opcode are actually the time it spends decoding the opcode or something. And maybe the two ignored bits at the end of the instruction word are the time that the Counter gets updated in time for the next instruction word to be searched for.

But what about the rest? There is a full twelve bits at the start of the instruction word asking to be put to good use. Now, I don't know anything about the internal workings of the LGP-30, and even less about vacuum tubes and whatnot, but it seems obvious to put in:

  1. an immediate mode, so the operand is in the instruction word itself.
  2. some bits to select between a number of different memory drums
  3. conditional execution bit or something (could examine the sign bit in the accumulator, or the breakpoint switches on the front panel)

the possibilities are endless.

I appreciate the computer was meant to be as cheap as possible, and came in at under $50000. But I also can't picture any of the three options I listed as being too expensive. For example, if the LGP-30 had been implemented in the 70s, I imagine 1. and 3. just needing a single 74xx00.

So is there either:

  • a timing-related reason why no functionality may be assigned to those ignored bits
  • or a technical reason why no functionality can cheaply be assigned to those ignored bits

that explains why only half the instruction word is actually in use?

6
  • 3
    Think of it from the other direction - for basic operation does it need any of what you propose? Low cost means taking out anything that isn't strictly necessary. It came out in 1956 using just 113 tubes and 1450 diodes. That is a minuscule amount for a full computer.
    – Brian
    Commented Nov 21, 2022 at 14:13
  • What where there for other computers the people behind LGP-30 could have had for reference? We might think immediate mode is normal to have, because it exists everywhere today. But what was the situation in known computers 1956?
    – UncleBod
    Commented Nov 21, 2022 at 14:16
  • 1
    Oioioi, what a nice question ... the reason is extreme simple, but compicated to explain. It's all within the link you posted. Let me see if I can rephrase it without getting too much offroad.
    – Raffzahn
    Commented Nov 23, 2022 at 2:41
  • Also, keep in mind that the LPG-30 is bit-serial, and the internal registers including the instruction register are also on the drum (as "recirculating" tracks). So the "ignored" bits probably leave the logic some time in places where it is needed, i.e. after instruction decode to processing of track/sector.
    – dirkt
    Commented Nov 23, 2022 at 17:12
  • @dirkt, yes, that's exactly what the question presupposes. It's just that the times look weird. And also, twelve bit-times should be more than enough time to put something else that's useful in. Commented Nov 23, 2022 at 17:24

1 Answer 1

10

TL;DR: There is not room for two instructions.

The LGP-30 word is 31 bits long. Bit 32 of a drum sector (word) is always 0. It will never be read nor operated upon. An instruction needs 16 bits, leaving 15 bits which is not enough for a second instruction.


The Details

It's Only 31 Bits

Your above calculation is about the 32 bits of a sector (drum word), not the 31-bit word the LGP-30 works on as shown in section R2.07 Number Words

   +-+-----------------------------------------------------------+-+
   |0|1 0 1 0 0 0 0 1 0 1 1 0 1 0 1 0 1 1 1 0 0 0 0 0 1 0 0 1 1 1|0|
   +-+-----------------------------------------------------------+-+
    ^                          ^                                  ^
    |                          |                                  |
 sign bit               30 magnitude bits                    spacer bit 
                                                        (always 0 in memory)

and section R2.08 Number Words

   +- bit numbers ---------+-------+---+-----------+-----------+-+-+
   |0 0 0 0 0 0 0 0 0 0 1 1|1 1 1 1|1 1|1 1 2 2 2 2|2 2 2 2 2 2|3|3|
   |0 1 2 3 4 5 6 7 8 9 0 1|2 3 4 5|6 7|8 9 0 1 2 3|4 5 6 7 8 9|0|1|
   +- bit values ----------+-------+---+-----------+-----------+-+-+
   |0 0 0 0 0 0 0 0 0 0 0 0|1 1 1 0|0 0|0 1 0 1 0 0|0 0 0 0 0 0|0|0|
   +-----------------------+(-----)+---+(---------)+(---------)+-+-+
                           order bits   track bits  sector bits
                             = add         = 20        = 00
                      instruction word = a 2000

(beautification mine)

of the linked page, which is, AFAICT the 1957 Programming Manual turned into ASCII including errors (and format issues).

It's also explained on page 3 of the LGP-30 Operations Manual:

enter image description here

Three Bytes to the Word

When activated the tape reader will input characters until a stop code (' or 100000b) is read. Whenever a new character comes the accumulator content is shifted by the character width to the left and the new character is added to the lowest bit positions. That way a word is formed which then can be stored. Character width read can be 4 or 6 bits, depending on a switch position.

With an 18-bit instruction format of 6(4+2)/6/6, reading (and shifting) three characters, each 6-bit unit from a 6 track paper tape would look like a perfect fit, wouldn't it?

  • One character for the operation, nicely selected in a way to give a meaningful mnemonic for most operations
  • One character for the track number
  • One character for the sector number

For example loading (bringing) a value from track 1 sector 1 into the accumulator could be (almost readably) encoded as:

           b z z

Except, after reading the word would be located at bit position 13..30, not 12..29 as the instruction format asks for. But why?

Does it Compute?

Looking at the basic format, it really feels as if the whole thing was first imagined with loading instructions as three 6 bit characters in mind and then reality hit in form of wasted paper tape. To cause all 6 bits to be loaded, every input would have to be always 6 characters long (*1). Introduction of a stop character would allow words to be shortened by leading zeroes. Except that now only 31 character encodings are available (*2), meaning one sector/track address can no longer be encoded. That's losing 3% of storage. Even worse, it's spread around the address space.

Four Bits for the Rescue

Now, if the byte size switch is set to 4, only 16 characters are needed for payload, leaving 48 for control. Except, now not even the mnemonic is readable any more. At that point it may be helpful to remember that tools like Assemblers were a dream of the future, maybe good for super-computers, but not an LGP-30. Thus it was a very common idea to make the binary encoding of operations a letter that can be associated with it. The IBM 1401 encoding might be a rather prominent example, and the LGP-30 is kind of its little brother.

Except, that wouldn't work out with 4-bit encoding as the opcode would be spread over two characters - at least if the instruction occupies bit position 13..30. Shifting the decoding by one (to 12..29) would make the opcode still readable. So add track 27 sector 10 would become

           a 1 g 2 8 '

Not great, but one could at least get a rough idea what the program is doing by looking dumping the tape on the printer. Likewise, using easy-to-memorize addresses for common variables would become a habit.

Long Story Short

The single spacer bit at the end is obviously due to the fact that with 4-bit instruction encoding at least the mnemonic is still plain text, while the two spacers after the operation are a leftover from a symmetric 6 bit structure.


*1 - The 31st bit would need the 6th just for itself.

*2 - The ever lasting curse of in-band-signalling.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .