All projects

CMPE263 Computer Architecture, Qatar University, Spring 2025

AMY

The future CPU of the past. An 8-bit processor designed from logic gates in Logisim by a team of three, with its own instruction set, ALU and control unit.

The name

AMY is the team's initials, and an acronym for Afkar Min Yutopia. Afkar is Arabic for thoughts, min means from, and Yutopia is a play on utopia: thoughts from utopia. It borrows from the way science fiction names its machines, JARVIS and friends.

The brief, and what was hard before building anything

The constraints were fixed: an 8-bit data path and address space, a small instruction set, fixed 8-bit instructions and four general-purpose registers. Two circuit problems had to be solved on paper first:

  • Signal racing. Signals reach a destination along paths of different lengths and arrive at different times, which gives inconsistent results. The fix was temporary registers that only update on a clock edge, holding intermediate values until the next cycle.
  • Bus conflicts. ROM, RAM and the ALU all want to drive the same data bus. Control gates owned by the control unit make sure only one source is ever connected at a time.

The rest of the difficulty was human. Logisim has no way to collaborate on a circuit, so the team split the CPU into components with one owner each and did version control by hand, in three stages: memory first, then routing with multiplexers and demultiplexers, then the control unit and its timing.

Architecture

Harvard, with the program in ROM and data in RAM, because separate memories made the access logic simpler and the time was short. RISC, for the same reason. And a hybrid of two textbook designs: the "basic computer" contributed the special registers (PC, IR and an address register AR), and a modern register file contributed four general-purpose registers selected through multiplexers.

The complete AMY CPU in Logisim: control unit, register and multiplexer stage, RAM and ROM stage and ALU, wired together with CPU Ready and Program Halted lights.
The whole CPU in Logisim. Four subcircuits: the control unit, the registers and multiplexers, RAM and ROM, and the ALU.

Instruction format

Every instruction is two bytes. The instruction register holds a 4-bit opcode and two 2-bit register fields; the address register holds a memory address, an immediate value, or nothing. R1 to R4 are encoded 00 to 11. Four bits of opcode allow sixteen instructions.

OpcodeInstructionExample
0000MOV (imm)MOV R2, 5
0001MOV (reg)MOV R3, R2
0010LDRLDR R1, [add.]
0011STRSTR [add.], R2
0100ADDADD R1, R2
0101SUBSUB R2, R3
0110LSLLSL R1
0111LSRLSR R2
1000CMPgrey rowCMP R3, R1
1001INCINC R3
1010DECDEC R2
1011JMPJMP address
1100JEgrey rowJE address
1101JNEgrey rowJNE address
1110JGgrey rowJG address
1111JLgrey rowJL address

The striped rows were greyed out in the report: designed into the opcode table, never built. CMP and the four conditional jumps were cut for time and left in the encoding so they could be added later. The emulator below has a tab that switches them on, so you can see what they would have unlocked.

Forty-one ticks per instruction

The control unit counts clock ticks with a 6-bit counter. Every instruction gets the same window: ticks 0 to 23 fetch from ROM, ticks 24 to 40 execute, using RAM if the instruction needs it. A gate watches for the count to reach 41 and resets the counter. Another flips the memory select line from ROM to RAM once the count passes 23. And if the instruction register reads 0xFF, the counter stops: that is the halt instruction.

The control unit's timing circuit in Logisim, annotated: a gate that resets the counter at 41, a gate that switches from ROM to RAM after tick 23, and a NAND that stops the counter when IR is 0xFF.
The timing circuit, annotated in the report.

A program, all the way down

Program 1 from the report loads 5 and 7, adds them into R1, and stores the result at address 20:

AssemblyIRAR
MOV R2, 50x040x05
MOV R3, 70x080x07
ADD R1, R20x410x00
ADD R1, R30x420x00
STR [20], R10x300x14
HLT0xFF0x00

These bytes are generated by the same encoder the emulator below runs, and a test checks every one against the report's own tables. The report is honest about the limit: its second program shows a loop, and notes that without conditional jumps it would run forever.

The emulator below runs both of the report's programs and the grey-row multiply. Step through one instruction at a time and watch the registers light up bit by bit.

Try it

From the report, listing 2

ROM IR = opcode | Rx | Rx, then AR

    Registers

    PC

    00

    IR

    00000000

    AR

    00

    Flags

    EQGTLT

    Ticks

    0

    reset

    RAM 10 to 1F

      RAM[20], the answer

      --

      Runs the instruction format from the project report: a 4-bit opcode, two 2-bit register fields, and an address byte. Programs 1 and 2 are the report's own listings.

      On this page

      Pages

      Write-ups

      Actions

      Elsewhere

      amanmohammed.xyz↑↓ move↵ select