CSci 230: Computing Systems Organization
Home Syllabus Readings Assignments Tests

Assignment 8: MINIAC

Due: 5:00pm, Friday, October 24. Value: 45 pts.

Using Logisim, design a circuit implementing the MINIAC computer described below, using miniac.circ as your starting point. [Link] (To download, you may need to right-click the link and select “Save Link As…”.) You may use any built-in Logisim components in completing this assignment.

The MINIAC instruction set was designed for the purpose of this assignment. It uses two one-byte registers, known as PC (program counter) and AC (accumulator). It includes a program memory containing 256 bytes implemented as read-only memory (ROM), and it has a data memory containing 32 bytes implemented as random-access memory (RAM).

Every MINIAC instruction is encoded in one byte: The top three bits give the operation to be performed, and the bottom five bits are an argument supporting the operation. Each of the three-bit combinations is tabulated below.

000xxxxx   BZ x   Branch if Zero
if AC = 0 then PC ← PC + signed(x) else PC ← PC + 1
001xxxxxBN x Branch if Negative
if AC < 0 then PC ← PC + signed(x) else PC ← PC + 1
010xxxxxST x STore
RAM[x] ← AC; PC ← PC + 1
011xxxxxRL x Rotate Left
AC ← AC rotated left by distance given in lower 3 bits of x; PC ← PC + 1
100xxxxxLI x Load Immediate
AC ← signed(x); PC ← PC + 1
101xxxxxLM x Load from Memory
AC ← RAM[x]; PC ← PC + 1
110xxxxxAD x ADd
AC ← AC + RAM[x]; PC ← PC + 1
111xxxxxSB x SuBtract
AC ← AC − RAM[x]; PC ← PC + 1

How to test your circuit

The MINIAC assembler Web page [Link] includes a variety of sample programs that you might use for testing your circuit. Or you can write your own. To use the page, enter your own program at top or select one of several included programs from the drop-down menu at top, then click the “Assemble” button.

If the program contains errors preventing assembly, then it will describe the errors below the program entry area. But if the program is valid, the page will display the MINIAC registers and memory below the program entry area, and you can then execute the program by repeatedly clicking the “Step” button, or you can watch it step through the program using “Run”.

Also on successful assembly, a text area will appear below the simulation area, containing text starting with “v2.0 raw”. This text area contains the machine code in a file format that Logisim accepts for its ROM circuits. To try loading the machine code into your own circuit, you first need to save this text into an ASCII file: Select all the text in the box (including “v2.0 raw”), copy it to the clipboard, paste it into your favorite text editor (on the Linux machines I recommend gedit), and save it into an ASCII file. Then go to your circuit in Logisim, right-click (or control-click) the ROM, select “Load Image…”, and select the name of the ASCII file you created. You will then want to start the clock ticking, either manually by clicking the clock component repeatedly or by selecting “Enable Ticks” from the Simulate menu.