NAME
mic1asm - assemble a microcode program with or without labels into 32-bit microinstructions
SYNOPSIS
mic1asm [ -ls ] [ -n ] source_file [ output_file ]
mic1asm [ -ls ] [ -n ] [ source_file ]
DESCRIPTION
mic1asm is one of a set of software tools designed for the hardware described in Chapter 4 of Structured Computer Organization (SCO), 2nd Edition by Andrew S. Tanenbaum. mic1asm takes as input one of two types of files: (1) a file of sequentially numbered microinstructions written in the Micro Assembly Language (see Section 4.4 of SCO) (2) a file of microinstructions which have labels rather than sequentially numbered lines. As output Mic1.assem produces an equivalent set of 32-bit microinstructions. The microprogram must begin on the first line of the source_file and there should not be any blank lines in the file. There should be at least one space after the colon ending the line number (or label) and the microcode. Similar format and syntax found in SCO Figure 4-16 should be followed.
OPTIONS
-l lists microinstructions along with its 32-bit microinstructions (Not to be used in combination with -n)
-s assumes source file has symbols
-n does no assemble, simply preprocesses a symboled file (Not to be used in combination with -l)
EXAMPLE
% cat symboled_source_file:
begin: mar:=pc; rd;
pc:=pc + 1; rd;
ir:=mbr; if n then goto begin;
tir:=lshift(ir + ir); if n then goto STOD;
tir:=lshift(tir); if n then goto LODD;
alu:=tir; if n then goto STOD;
LODD: mar:=ir; rd; {0000 = LODD}
rd;
ac:=mbr; goto begin;
STOD: mar:=ir; mbr:=ac; wr; {0001 = STOD}
wr; goto begin;
% mic1.assem -sl symboled_source_file
0: mar:=pc; rd;
00010000110000000000000000000000
1: pc:=pc + 1; rd;
00000000010100000110000000000000
2: ir:=mbr; if n then goto 0;
10110000000100110000000000000000
3: tir:=lshift(ir + ir); if n then goto 9;
00100100000101000011001100001001
4: tir:=lshift(tir); if n then goto 6;
00110100000101000000010000000110
5: alu:=tir; if n then goto 9;
00110000000000000000010000001001
6: mar:=ir; rd; {0000 = LODD}
00010000110000000011000000000000
7: rd;
00010000010000000000000000000000
8: ac:=mbr; goto 0;
11110000000100010000000000000000
9: mar:=ir; mbr:=ac; wr; {0001 = STOD}
00010001101000000011000100000000
10: wr; goto 0;
01110000001000000000000000000000
% mic1.assem -n symboled_source_file result_file
% cat result_file
0: mar:=pc; rd;
1: pc:=pc + 1; rd;
2: ir:=mbr; if n then goto 0;
3: tir:=lshift(ir + ir); if n then goto 9;
4: tir:=lshift(tir); if n then goto 6;
5: alu:=tir; if n then goto 9;
6: mar:=ir; rd; {0000 = LODD}
7: rd;
8: ac:=mbr; goto 0;
9: mar:=ir; mbr:=ac; wr; {0001 = STOD}
10: wr; goto 0;
% mic1.assem result_file
00010000110000000000000000000000
00000000010100000110000000000000
10110000000100110000000000000000
00100100000101000011001100001001
00110100000101000000010000000110
00110000000000000000010000001001
00010000110000000011000000000000
00010000010000000000000000000000
11110000000100010000000000000000
00010001101000000011000100000000
01110000001000000000000000000000
SEE ALSO
macasm
BUGS
The following 2 limitations are known to exist. The assembler will not assemble the incorrect versions even though they are technically permitted on our hardware; they will print an error message.
(1) Problems are known to arise when multiple assignments are made in a single microinstruction. For example, most of the time, the mar (when used) should appear first in the microinstruction:
ex. correct -- mar:=sp; sp:=sp + 1;
incorrect -- sp:=sp + 1; mar:=sp;
(2) If mbr is used in an add operation, then it must appear first:
ex. correct -- ac:=mbr + ac;
incorrect -- ac:=ac + mbr;
BUG: Related to trying to do multiple assignments in a single microinstruction. The assembler will NOT give you an error message; it will return INCORRECT microcode!
ex. mar:=ir; pc:=ir;
Problem explanation: For the first assignment, the assembler puts the ir on the b_bus to get it into the mar. For the second assignment, the assembler finds that ir has already been loaded onto the b_bus, so it does nothing extra. Unfortunately, to get the ir into the pc using the default alu function of 'pass the contents of the a_bus through', the ir must also be placed on the a_bus. Regrettably, if this bug is fixed, then the following statement will not assemble even though it is technically correct!
mar:=ir; pc:=ir+ac;
Here the assembler during parsing will place the ir on both the b_bus and a_bus, and then have no place to put the ac! Currently, the assembler will produce the correct code for the above statement.
Bugs should be mailed to 'amer@dewey.udel.edu'.
AUTHORS
Suzanne M. Cybulski, Pat Demasco - designed under the supervision of Professor Paul Amer for use in the University of Delaware's CIS 360: Computer Architecture classes.