Title: MARIE: An Introduction to a Simple Computer
1Chapter 4
- MARIE An Introduction to a Simple Computer
24.1 Introduction
34.2 MARIE
- This is the MARIE architecture shown graphically.
44.2 MARIE
- This is the MARIE data path shown graphically.
54.2 MARIE
- This is the format
- of a MARIE instruction
- The fundamental MARIE instructions are
64.2 MARIE
- This is a bit pattern for a LOAD instruction as
it would appear in the IR - We see that the opcode is 1 and the address from
which to load the data is 3.
74.2 MARIE
- This is a bit pattern for a SKIPCOND instruction
as it would appear in the IR - We see that the opcode is 8 and bits 11 and 10
are 10, meaning that the next instruction will be
skipped if the value in the AC is greater than
zero.
What is the hexadecimal representation of this
instruction?
84.2 MARIE
- The RTL for the LOAD instruction is
- Similarly, the RTL for the ADD instruction is
MAR ? X MBR ? MMAR, AC ? MBR
MAR ? X MBR ? MMAR AC ? AC MBR
94.2 MARIE
- Recall that SKIPCOND skips the next instruction
according to the value of the AC. - The RTL for the this instruction is the most
complex in our instruction set
If IR11 - 10 00 then If AC lt 0 then PC ? PC
1 else If IR11 - 10 01 then If AC 0 then
PC ? PC 1 else If IR11 - 10 11 then If AC
gt 0 then PC ? PC 1
104.3 Instruction Processing
114.4 A Simple Program
- Consider the simple MARIE program given below.
We show a set of mnemonic instructions stored at
addresses 100 - 106 (hex)
124.4 A Simple Program
- Lets look at what happens inside the computer
when our program runs. - This is the LOAD 104 instruction
134.4 A Simple Program
- Our second instruction is ADD 105
144.5 A Discussion on Assemblers
- Consider our example program (top).
- Note that we have included two directives HEX and
DEC that specify the radix of the constants. - During the first pass, we have a symbol table and
the partial instructions shown at the bottom.
154.5 A Discussion on Assemblers
- After the second pass, the assembly is complete.
164.6 Extending Our Instruction Set
- To help you see what happens at the machine
level, we have included an indirect addressing
mode instruction to the MARIE instruction set. - The ADDI instruction specifies the address of the
address of the operand. The following RTL tells
us what is happening at the register level
MAR ? X MBR ? MMAR MAR ? MBR MBR ? MMAR AC ?
AC MBR
174.6 Extending Our Instruction Set
- Another helpful programming tool is the use of
subroutines. - The jump-and-store instruction, JNS, gives us
limited subroutine functionality. The details of
the JNS instruction are given by the following
RTL
MBR ? PC MAR ? X MMAR ? MBR MBR ? X AC ? 1 AC
? AC MBR PC ? AC was originally wrong!
Does JNS permit recursive calls?
184.6 Extending Our Instruction Set
- 100 LOAD Addr
- 101 STORE Next
- 102 LOAD Num
- 103 SUBT One
- 104 STORE Ctr
- 105 CLEAR
- 106 Loop LOAD Sum
- 107 ADDI Next
- 108 STORE Sum
- 109 LOAD Next
- 10A ADD One
- 10B STORE Next
- 10C LOAD Ctr
- 10D SUBT One
10E STORE Ctr 10F SKIPCOND 000 110 JUMP
Loop 111 HALT 112 Addr HEX 118 113 Next
HEX 0 114 Num DEC 5 115 Sum DEC 0 116
Ctr HEX 0 117 One DEC 1 118 DEC 10 119
DEC 15 11A DEC 2 11B DEC 25 11C DEC
30
194.13 A Discussion on Decoding
- A computers control unit keeps things
synchronized, making sure that bits flow to the
correct components as the components are needed. - There are two general ways in which a control
unit can be implemented hardwired control and
microprogrammed control. - With microprogrammed control, a small program is
placed into read-only memory in the
microcontroller. - Hardwired controllers implement this program
using digital logic components.
204.13 A Discussion on Decoding
- Your text provides a complete list of the
register transfer language for each of MARIEs
instructions. - The microoperations given by each RTL define the
operation of MARIEs control unit. - Each microoperation consists of a distinctive
signal pattern that is interpreted by the control
unit and results in the execution of an
instruction. - Recall, the RTL for the Add instruction is
MAR ? X MBR ? MMAR AC ? AC MBR
214.13 A Discussion on Decoding
- Each of MARIEs registers and main memory have a
unique address along the datapath. - The addresses take the form of signals issued by
the control unit.
How many signal lines does MARIEs control unit
need?
224.13 A Discussion on Decoding
- Let us define two sets of three signals.
- One set, P0, P1, P2, controls reading from memory
or a register, and the other set consisting of
P3, P4, P5, controls writing to memory or a
register.
The next slide shows a close up view of MARIEs
MBR.
234.13 A Discussion on Decoding
This register is enabled for reading when P0 and
P1 are high, and it is enabled for writing when
P3 and P4 are high
244.13 A Discussion on Decoding
- Careful inspection of MARIEs RTL reveals that
the ALU has only three operations add, subtract,
and clear. - We will also define a fourth do nothing state.
- The entire set of MARIEs control signals
consists of - Register controls P0 through P5.
- ALU controls A0 through A3
- Timing T0 through T7 and counter reset Cr
254.13 A Discussion on Decoding
- Consider MARIEs Add instruction. Its RTL is
- MAR ? X
- MBR ? MMAR
- AC ? AC MBR
- After an Add instruction is fetched, the address,
X, is in the rightmost 12 bits of the IR, which
has a datapath address of 7. - X is copied to the MAR, which has a datapath
address of 1. - Thus we need to raise signals P2, P1, and P0 to
read from the IR, and signal P3 to write to the
MAR.
264.13 A Discussion on Decoding
- Here is the complete signal sequence for MARIEs
Add instruction - P0 P1 P2 P3 T0 MAR ? X
- P0 P2 T1 MBR ? MMAR
- A0 P0 P1 P2 P5 T2 AC ? AC MBR
- Cr T3 Reset counter
- These signals are ANDed with combinational logic
to bring about the desired machine behavior. - The next slide shows the timing diagram for this
instruction..
274.13 Decoding
- Notice the concurrent signal states during each
machine cycle C0 through C3.
P0 P1 P2 P3 T0 MAR ? X P0 P2 T1 MBR ?
MMAR A0 P0 P1 P2 P5 T2 AC ? AC MBR
Cr T3 Reset counter
284.13 A Discussion on Decoding
- We note that the signal pattern just described is
the same whether our machine used hardwired or
microprogrammed control. - In microprogrammed control, the bit pattern of an
instruction feeds directly into the combinational
logic within the control unit.
294.13 A Discussion on Decoding
- This is the hardwired logic for MARIEs Add
0011 instruction.
304.13 A Discussion on Decoding
- In microprogrammed control, instruction microcode
produces control signal changes. - Machine instructions are the input for a
microprogram that converts the 1s and 0s of an
instruction into control signals. - The microprogram is stored in firmware, which is
also called the control store. - A microcode instruction is retrieved during each
clock cycle.
314.13 A Discussion on Decoding
- This is how a generic microprogrammed control
unit might look.
324.13 A Discussion on Decoding
- If MARIE were microprogrammed, the
microinstruction format might look like this - MicroOp1 and MicroOp2 contain binary codes for
each instruction. Jump is a single bit indicating
that the value in the Dest field is a valid
address and should be placed in the
microsequencer.
334.13 A Discussion on Decoding
- The table below contains MARIEs microoperation
codes along with the corresponding RTL
344.13 A Discussion on Decoding
- The first nine lines of MARIEs microprogram are
given below (using RTL for clarity)
354.13 A Discussion on Decoding
- The first four lines are the fetch-decode-execute
cycle. - The remaining lines are the beginning of a jump
table.
364.13 A Discussion on Decoding
- Its important to remember that a microprogrammed
control unit works like a system-in-miniature. - Microinstructions are fetched, decoded, and
executed in the same manner as regular
instructions. - This extra level of instruction interpretation is
what makes microprogrammed control slower than
hardwired control. - The advantages of microprogrammed control are
that it can support very complcated instructions
and only the microprogram needs to be changed if
the instruction set changes (or an error is
found).
37Homework Page 237