Chapter 4 SB Answers
Chapter 4 SB Answers
Chapter 4 SB Answers
Activity 4A
1 a) i) CIR – stores the current instructions being executed.
ii) MAR – stores the address of the memory location which is about to be accessed.
iii) PC – stores the address of the next instruction to be executed.
b) i) N = negative flag; set to 1 if result of calculation is negative
C = carry flag; set to 1 if there is a carry bit following a calculation
V = overflow flag; set to 1 if there is an overflow bit following a calculation
when two bytes are added together an arithmetic carry bit is generated from the most
significant bit position:
(Note: the carry bit is used for unsigned integers)
10000110
11001011 C 1
𝟏01010001
overflow occurs when 7 bits are used for the binary number and the 8th bit is a sign
bit; if +127 is the largest integer which can be stored then a sum > 127 will cause
overflow:
01110001
01011110 V 1
𝟏1001111
4 a) Fetch-execute cycle
is the basic operational process of a computer system
is the process whereby computer fetches (retrieves) a program instruction from memory
and determines what the instruction ‘means’
once decoded, the instruction is executed
makes use of buses and addresses to carry out the various functions/operations.
b) MAR [PC] (contents of PC copied into MAR)
PC [PC] + 1 (PC is incremented by 1)
MDR [[MAR]] (data stored at address shown in MAR is copied into MDR)
CIR [MDR] (contents of MDR copied into CIR)
5 fetches, immediate access store (IAS), program counter (PC), MAR, address bus, MDR, decoded,
executed, control signals, control bus, ALU, accumulator
2 Examples include, Intel Pentium and X86, AMD and X86, ARM and A32 or A64 or T32
3 Examples include, Intel i7 and X86, Qualcomm Octo (ARM) and A64
Activity 4B
1 a) i) 200
ii) 300
(iii) 50
b) i) CMP #5
ii) JPE 100
2 a)
Label Address
nomore 106
Number1 109
Number2 110
Number3 111
Number4 112
total 113
b)
CIR Opcode Operand ACC total 113
107 END 10 10
c) Subtracts number2 from number1, then add number3. Only add number4 if the result of
the first calculation is not equal to 10. Store the answer in total
3 a)
LDR #0 Set IX to 0
loop: LDX array Load the element of the array indexed by IX into ACC
END
#79
#68
#69
b)
Label Address
loop 103
array 113
counter 117
c)
CIR Opcode Operand ACC IX counter Output
100 LDM #0 0
102 LDR #0 0 0 0
104 OUT 67 0 0 C
105 INC IX 67 1 0
109 CMP #4 1 1 1
104 OUT 79 1 1 O
105 INC IX 79 2 1
109 CMP #4 2 2 2
104 OUT 68 2 2 D
105 INC IX 68 3 2
109 CMP #4 3 3 3
104 OUT 69 3 3 E
105 INC IX 69 4 3
109 CMP #4 4 4 4
Activity 4C
1 a) i) B10010000
ii) B00000000
b) i) OR #B1000
ii) XOR #B1
2 a) Arithmetic shifts preserve the sign bit of the number and logical shifts always fill with zeros.
b) No bits are lost during a shift, bits shifted out of one end of the register are introduced at the
other end of the register, for example an 8-bit register containing the binary value 10101111
shifted left cyclically 3 places would become 01111101.
2 a HDMI
allows output (audio and visual) from a computer to be connected to HDMI-enabled
monitor/tv
supports high definition and enhanced signals
it is a digital system which can support high definition televisions which require more data
and at a faster data transfer rate
can also protect against piracy by using authentication protocols
supports a refresh rate of 120 Hz.
VGA
supports 640×480 resolution with refresh rate of 60 Hz
analogue system which makes it easier to split the signals between more than one device.
USB
allows computers to communicate with peripherals
uses 4-wire shielded cables
devices are automatically detected when plugged into computer USB port
serial data transmission
industry standard to connect devices to a computer.
b Interrupts
data sent to printer buffer from computer
contents of buffer sent to printer and document starts to be printed
processor carries on with other tasks while printing continues in background
if printer runs out of paper, runs out of ink, paper jam (etc.) then it sends out an interrupt
signal
if interrupt sent out, message is displayed on computer screen requesting user to resolve
issue
once all the data from the buffer is printed, printer sends an interrupt signal to the processor
requesting more data
depending on its priority, interrupt is serviced
once interrupt is serviced, more data is sent to the printer buffer and the above stages are
repeated until all 1000 pages are printed out.
3 a i) ii) PC – stores address of next instruction to be executed
MDR – stores data in transit between memory and other registers
CIR – stores current instruction being executed
MAR – stores address of memory location which is about to be accessed
4 Logical shift – bits shifted out of the register are replaced with zeros, for example an 8-bit
register containing the binary value 10101111 shifted left logically 3 places would become
01111000
Arithmetic shift – the sign of the number is preserved, for example an 8-bit register containing
the binary value 10101111 shifted right arithmetically 3 places would become 11110101.
Arithmetic shifts can be used for multiplication or division by powers of two.
Cyclic shift – no bits are lost during a shift, bits shifted out of one end of the register are
introduced at the other end of the register, for example an 8-bit register containing the binary
value 10101111 shifted left cyclically 3 places would become 01111101
5
a) i) monitoring system
ii) there is no ‘control’ taking place
b) Pressure …If intruder steps on sensor, Infra-red …If beam cut by intruder
c) i) SENSORS COUNT VALUE ACC
B00001010 0 1 B00001010
B00000000
1
2 2
B00001010
B00000010
0
1 1
2
4 4
B00001010
B00000000
4
8 8
B00001010
B00001000
1
2 2
8
c) ii) #1
c) iii) CMP #8 instruction
CMP #128