03 Hardware and Virtual Machines
03 Hardware and Virtual Machines
Produce truth tables for logic circuits including half adders and full adders
Definitions
Instruction level parallelism applied to execution of instructions during
Pipelining
Fetch-Execute cycle
SIMD (Single Instruction Many processors execute the same instructions but use different data
Multiple Data) inputs
MISD (Multiple Instruction Multiple processors execute different instruction but use the same shared
Single Data) data source
MIMD (Multiple Instruction Multiple processors take instructions independently and use data from a
Multiple Data) separate data source
Massively Parallel Large number of processors working collaboratively on the same program
Computers simultaneously communicating via messaging interface
Host Operating System The OS that is controlling the actual physical hardware
Half adder A logic circuit that adds two bits together and outputs their sum
Full adder Adds two bits and a carry bit from the previous calculation together
Circuits in which the output depends on the input value produced form a
Sequential Circuits
previous output value
Karnaugh Maps (K-map) A method used to simplify logic statements and logic circuits
A single instruction can be more complex and involve more loading of data from memory
RISC Processors
Reduced Instruction Set Computer
Longer execution time for instructions Faster execution time for instructions
It is more difficult to make pipelining work Easier to make pipelining function correctly
The design emphasis is on the hardware The design emphasis is on the software
Pipelining
Instruction level parallelism applied to execution of instructions during Fetch-Execute cycle
When one instruction is done, the same stage of another instruction can be executed
Hence, an instruction can start executing before the previous one has finished, allowing several instructions to be
processed simultaneously
Used extensively in RISC processor based systems to reduce the time taken to run processes
Can be a data dependency issue where one instruction is not done with generating a result that is used by the
subsequent instruction.
Solution: Swap the instruction that wants to access to early with the next one that doesn’t depend on the result
Interrupts
Once the processor detects the existence of an interrupt, the current program would be temporarily stopped
The status of each register is stored; the processor can then be stored to its original status before the interrupt was
received and serviced
With pipelining, a number of instructions could be in the pipeline as the instruction is received
Solution: Discard all instructions in the pipeline except for the last instruction in the write-back (WB) stage
Interrupt Service Routine (ISR) can then be applied to this remaining instructions, and once serviced, the processor
can restart with the next instruction in the sequence.
Many processors execute the same instructions but use different data inputs
Multiple processors execute different instruction but use the same shared data source
Multiple processors take instructions independently and use data from a separate data source
Issue: Complex topology in connecting the processors so that they can communicate
Split code into blocks that can be processed simultaneously instead of sequentially
Process when Application in guest OS makes a request to guest OS to get data from file:
Security benefits; if it has a virus, it will only infect the virtual machine
Limitations
Has poorer performance than real machines because of extra load on the computer
Costly to maintain
1. Most desktop or laptop computers uses CISC (Complex Instruction Set Computing) architecture. Most smartphones
and tablets use RISC (Reduced Instruction Set Computing). [4]
State
four features that are different for the CISC and RISC architectures
The following table shows five stages that take place when instructions are fetched and executed. In time interval
1, instruction A has been fetched.
a. In the table, write the instruction labels (A, B, C, D) in the correct time interval for each stage. Each operation
only takes one time interval. [3]
Time Interval
Stage 1 2 3 4 5 6 7
Fetch
A
Instruction
Decode
Instruction
Execute
Instruction
Access
operand in
memory
Write result to
register
b. When completed, the table in part (b)(i) shows how pipelining allows instructions to be carried out more rapidly.
Each time interval represents one clock cycle.
Calculate how many clock cycles are saved by using pipelining in the example in
part (b)(i).
Show your working.
Solution
1. RISC has fewer instructions than CISC. RISC has many registers, while CISC has a few registers. RISCs
instructions are simpler than CISC instructions. RISC has better pipelineability than CISC. RISC makes more use
of RAM than CISC.
a. Stage 1 2 3 4 5 6
Fetch
A B C D
Instruction
Decode
A B C D
Instruction
Execute
A B C D
Instruction
Access
operand in A B C
memory
Write result to
A B
register
3.
A + (B + C) = (A + B) +
Associative Laws A.(B.C) = (A.B).C
C
A.(B + C) = (A.B) +
(A.C)
Distributive Laws A + (B.C) = (A + B).(A + C)
(A + B)
.(A + C) = A + B.C
Double Negative
A = A
Law
Note: The minus sign in the last two row signifies NOT (For example A- = A̅)
A logic circuit that adds two bits together and outputs their sum
Inputs Outputs
A B S C
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
Full Adder
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
Have 2 states
Store 1 bit, 0 or 1
Used in memory
SR Flip-Flops
Consists of 2 cross-coupled NAND or NOR gates
S R Q Q̅
1 0 1 0
0 1 0 1
1 1 0 0
Problem:
The last row is an invalid state as Q and Q̅ have the same value
JK Flip-Flops
To overcome SR issues:
A clock and additional gates are added which helps synchronize the 2 inputs
0 0 0 0
Q is unchanged
after clock pulse
0 0 1 1
1 0 0 1
Q=1
1 0 0 1
0 1 0 0
Q=0
0 1 1 0
1 1 0 1
Q value toggles
between 0 and 1
1 1 1 0
Uses of JK Flip-Flops
Gray Code: Ordering o binary numbers such that successive numbers differ by 1 bit only
Rules:
The values along the top and the bottom follow Gray code rules
Single values can be regarded as a group even if they cannot be combined with other values to form a larger group
The final Boolean expression can only consider those values which remain constant within the group
2. Draw loop(s) around appropriate group(s) in the K-map to produce an optimal sum-of-products
3. Write the Boolean expression from your answer to part (b) as a simplified sum-of-products. Use Boolean algebra
to give your answer in its simplest form.
Solution
1.
2.
Points To Note
A control unit can be hard-wired or microprogrammed
RISC (Reduced Instruction Set Computers) processors have a number of advantages compared to CISC (Complex
Instruction Set Computers)
Parallelism can be based at the instruction level, processor level or computer level
Binary addition can be carried out using a half adder or a full adder circuit
There are Boolean algebra laws that can be used to simplify logic expressions
The sum-of-products method can be used to create an equivalent logic expression containing minterms from a truth
table
A Karnaugh map is a representation of a truth table that allows a simplified logic expression to be derived from a truth
table