ROMs With Multiple Word Formats

At times it is necessary or useful to be able to specify more than one command format. The most obvious use of multiple formats would be when the ROM words actually have more than one physical format. Some microcode sequencers use different physical formats for jumps, conditional jumps and ordinary microinstructions. Another less obvious use of multiple formats is when you wish to give the illusion of multiple command formats, even though there is only one physical format. To illustrate, consider the case of providing conditional and unconditional jumps. One way to implement unconditional jumps is to treat them as conditional jumps and use a condition that is always true. The same scheme could be used to implement ordinary micro-instructions as conditional jumps using a condition that is always false. For conditional jumps it would be convenient to have two required fields, condition, and jump address. On the other hand, it would be inconvenient to require explicit specification of conditions on unconditional jumps and ordinary instructions. Similarly on ordinary microinstructions no required operands would seem to be most appropriate.

The ROM preprocessor allows multiple formats to be declared, and allows each opcode to be associated with a particular format. Let us continue with the jump/conditional-jump/ordinary example, and assume that every rom word has a condition field and a next address field. The condition field is used by the sequencer to select a particular condition to be tested. Let us assume that 0 will select "always-false" and 1 will select "always-true." The first step is to define the opcodes, as follows.
jump: equ 1

cjump: equ 2

cont: equ 3


In this example, we will not use an opcode field, so the three symbols could just as easilly be given the same value. We give them different values just in case we change our mind about having an opcode field. The next step is to assign each opcode to a format. The "format" statement is used for this purpose. The following illustrates.
fjump: format jump

fcjump: format cjump

fcont: format cont

The operand field of the "format" statement is a list of one or more command names. The label of the statement is the name of the format. All of the opcodes in the operand field will be associated with the format named in the label.

As fields are defined, they also must be assigned to a format. The following is the definition of the condition field for each of the three formats.
conda: field position=0,width=3,cmdpos=1,format=fcjump

condb: field position=0,width=3,default=1,format=fjump,type=constant

condc: field position=0,width=3,default=0,format=fcont,type=constant

Note that these three fields all occupy the same place in the rom word. When multiple formats are used, the rules for overlapping fields are modified somewhat. There may not be any overlapping fields in a single format. Furthermore, there must be a definition for each field in each format. The "type=constant" parameter may be used to prevent the user from assigning a value to a field in a particular format. The ROM preprocessor will issue an error message if a value is assigned to a constant field.

The next step in this example is to define the address fields. This field will be constant zero for ordinary microinstructions (cont opcode), it will be a required field for the other two opcodes. It must be specified in command position zero for jumps and command position one for conditional jumps. The following is the definition of these fields.
addra: field position=3,width=8,default=0,format=fcont,type=constant

addrb: field position=3,width=8,cmdpos=(0,1),format=(fjump,fcjump)

Note that only two field descriptions are required. The format parameter can be used to assign a field to more than one format, as illustrated above. When the "cmdpos" parameter is used with a field assigned to more than one format, a single number can be used to specify that the field appears in the same command position in each format, or a list of numbers can be used (one per format) to specify that the field appears at different command positions in each format.

For the sake of illustration, let us assume that all romwords have three one-bit control fields, regardless of format, and that none of these are required fields. We can define these fields as follows.
ctl_a: field position=11,format=(fcont,fjump,fcjump)

ctl_b: field position=12,format=(fcont,fjump,fcjump)

ctl_c: field position=13,format=(fcont,fjump,fcjump)


To complete the example, here are some statements that define rom words.
beg: cont ctl_a

cont

cont

cjump xcond,endit,ctl_c

jump beg,ctl_a

endit: jump *,ctl_b

The first format defined in the text is the default format. All fields without "format" parameters, are assigned to the default format. The default format is used for "word" opcodes and for opcodes that are not explicitly mentioned in a "format" statement. The default format is used for creating dummy words to fill holes left by "org" statements.