CS计算机代考程序代写 arm assembler Chapter 4

Chapter 4

MARIE: An Introduction

to a Simple Computer

2

4.13 A Discussion on Decoding

• The control unit orchestrates all operations in the
processor, making sure that data flows to the correct

components as the components are needed.

• There are two general ways in which a control unit
can be implemented:
– hardwired control

• Digital logic drives the signals that control data flow

– microprogrammed control
• A small program drives the signals that control data flow.

3

• The textbook provides a complete list of the register
transfer language for each of MARIE’s instructions.

• The microoperations given by each RTL define the

operation of MARIE’s 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  M[MAR]

AC  AC + MBR

4.13 A Discussion on Decoding

4

• Each of MARIE’s
registers and main

memory have a unique

address along the data
path.

• The addresses take the
form of signals issued by

the control unit.

How many signal lines does

MARIE’s control unit need?

4.13 A Discussion on Decoding

5

• Let us define two sets of
three signals.

• One set, P2, P1, P0,

controls reading from
memory or a register, and

the other set consisting of
P5, P4, P3, controls

writing to memory or a

register.

The next slide shows a close up

view of MARIE’s MBR.

4.13 A Discussion on Decoding

6

• Careful inspection of MARIE’s RTL reveals that
the ALU has only three operations: add, subtract,

and clear.
– We will also define a fourth “do nothing” state.

4.13 A Discussion on Decoding

• The entire set of MARIE’s
control signals consists of:

– Register controls: P0 through

P5, MR , and MW.

– ALU controls: A0 through A3
and LALT to control the ALU’s

data source.

– Timing: T0 through T7 and

counter reset Cr

7

• Consider MARIE’s Add instruction. Its RTL is:
MAR  X

MBR  M[MAR]

AC  AC + MBR

• After an Add instruction is fetched, the address, X,

is in the rightmost 12 bits of the IR, which has a
data path address of 7.

• X is copied to the MAR, which has a data path

address of 1.

• Thus, we need to raise signals P0, P1, and P2 to
read from the IR, and signal P3 to write to the MAR.

4.13 A Discussion on Decoding

8

• Here is the complete signal sequence for MARIE’s
Add instruction:

P3 P2 P1 P0 T3 : MAR  X

P4 P3 T4 MR : MBR  M[MAR]

P5 T5 Cr A0 LALT : AC AC+MBR

[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.

4.13 A Discussion on Decoding

9

P3 P2 P1 P0 T3 : MAR  X

P4 P3 T4 MR : MBR  M[MAR]

Cr A0 P5 T5 LALT : AC  AC + MBR

[Reset counter]

4.13 Decoding

• Notice the concurrent signal
states during each machine

cycle: C3 through C5.

10

• We note that the signal pattern just described is
the same whether our machine used hardwired or

microprogrammed control.

• In hardwired control, the bit pattern of machine

instruction in the IR is decoded by combinational
logic.

• The decoder output works with the control signals
of the current system state to produce a new set

of control signals.

4.13 A Discussion on Decoding

A block diagram of a hardwired control

unit is shown on the following slide.

11

4.13 A Discussion on Decoding

12

MARIE’s

instruction

decoder.

(Partial.)

4.13 A Discussion on Decoding

13

4.13 A Discussion on Decoding

A ring

counter

that counts

from 0 to 5

14

This is the

hardwired

logic for

MARIE’s

Add = 0011

instruction.

15

• 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.

4.13 A Discussion on Decoding

16

• The table below contains MARIE’s microoperation
codes along with the corresponding RTL:

4.13 A Discussion on Decoding

17

• The first nine lines of MARIE’s microprogram are given

below (using RTL for clarity):

4.13 A Discussion on Decoding

18

4.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.

19

• It’s 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 complicated instructions and only

the microprogram needs to be changed if the
instruction set changes (or an error is found).

4.13 A Discussion on Decoding

20

• MARIE shares many features with modern
architectures, but it is not an accurate depiction of

them.

• There are two main architecture types

– CISC: Complex Instruction Set Computer.
• Many instructions, specialized instructions.

• Fewer instructions needed to perform common tasks.

• Intel architecture is a CISC

– RISC: Reduced Instruction Set Computer.

• Fewer instructions, general purpose instructions.

• Many instructions needed to perform common tasks.

• ARM architecture is RISC

4.14 Real World Architectures

21

• The Intel architecture started with the 8086 in 1979

• IBM used the 8088 for the first IBM PC in 1981

• The 8086, 8088 were 16-bit with 20-bit addresses

– Four general purpose registers, segmented memory

• The 80386 brought 32-bit support in 1985

– Was backwards compatible with existing 16-bit code

• The 80486 included the floating-point unit in 1989

• The Pentium 4 introduced hyperthreading in 2002

• AMD introduced 64-bit support in 2003

• Multicore was introduced in 2005

4.14 Real World Architectures

22

• The ARM family of CPUs successful in its class.

• The ARM architecture started with ARM1 in 1985

• 32-bit architecture, 24-bit addresses.

• RISC design with multiple general-purpose registers

and a small simple instruction set.

• 64-bit support was added in 2011

• Used in numerous devices, gained recent popularity

in smartphones and most recently Apple’s M1.

4.14 Real World Architectures

23

• Major components of a computer system are its
control unit, registers, memory, ALU, data path.

• A clock keeps everything synchronized.

• Control units can be microprogrammed or hardwired.

• Computers run programs through iterative
fetch-decode-execute cycles.

• Computers can run programs that are in machine

language.

• An assembler converts mnemonic code to machine

code.

Chapter 4 Conclusion

•h
ttp

://w
w

w
.v

is
u
a

l6
5

0
2

.o
rg

/J
S

S
im

/in
d

e
x
.h

tm
l