Week 2
Storing bits – RS Flip Flops
COS10004 Computer Systems · Lecture 2.2 – Storing bits - RS Flip Flops
WHAT IS A COMPUTER SYSTEM?
Fast memory Persistent
(RAM) memory (Disks
- program and data and other non- volatile memory) Central Mother Graphics processing board unit (CPU) Keyboard Input / Output accel Channels cards Mouse
Hardware What else?
BASICS OF ELECTRONIC STORAGE – CPU REGISTERS
- In a computer the output is determined by current inputs and memory (previous inputs) computed together.
Inputs Combinatorial Outputs
Logic
Memory
CPU needs some way to remember information
STORING 1 BIT
- Memory is built up of 1-bit storage units.
- We need a circuit that holds one bit.
- We set what it is to remember and it retains this until we actively change it (unless the power goes off!).
- The simplest is the RS Flip-Flop
4 COS10004 Computer Systems 4
RS FLIP-FLOP – OPERATIONS
At start assume QA=0 (QB=1)
- This is a stable state
- a change in the Reset value from 1 to 0 will not change either output. Here, “Set” means pull the Set 1 0 Set pin to ground (0) to A QA activate it (i.e, QA = 1) 1 RESET state
0 B Q
B
5 COS10004 Computer Systems 5
RS FLIP-FLOP – OPERATIONS
If Set is made low (0) for a moment, the output of A (QA) goes high (1).
Set 1 A 0 Q turning the output of B (QB) to low (0). A
1 0 SET state
further change. B QB
Making Set active (low) has set QA output high.
6 COS10004 Computer Systems 6
RS FLIP-FLOP – OPERATIONS
Confused?
It's a toggle switch using push- Set 1 A 1 Q buttons. 0 A SET state Pull Set low for a moment and QA 1 B turns on. Reset 1 0 QB
turns on. A Q
A QA and QB can never be on or off at RESET state the same time 0 B QB
7 COS10004 Computer Systems 7
- Exercise
- complete the timing diagram below
Set 1 A 0 Q (aka Q) A 1 RESET state
0 B Q (aka Q) B 0 only when Reset 1 1 Reset pressed.
SET
Reset
Q
8 COS10004 Computer Systems 8
- Exercise
- complete the timing diagram below
SET
Reset
Q RESET state
SET state Q
9 COS10004 Computer Systems 9
ACTIVE LOW INPUT RS FLIP-FLOP – TRUTH TABLE
SET RESET Q Q
0 0 indeterminant dangerous!!!
0 1 1 0 1 0 0 1
1 1 no change NB Both inputs must not be active (pulled low) at the same time The flip flop outputs may change whenever an input changes. If we want synchronized changes we need to build more complex Flip-Flops!
10 COS10004 Computer Systems 10
A N RS FLIP FLOP WITH ACTIVE HIGH INPUTS
Q
An RS flip flop made out of cross coupled NOR gates has active high inputs. The stable states are as shown. Q Q. 1 Taking Reset momentarily high will set Q i.e. reset Q. Q
0 Q
11 COS10004 Computer Systems 11
NOR-BASED (ACTIVE HIGH) INPUT RS FLIP-FLOP –
TRUTH TABLE
SET RESET Q Q
0 0 no change
0 1 1 0 1 0 0 1
1 1 indeterminate NB Both inputs must not be active at the same time The flip flop outputs may change whenever an input changes. If we want synchronized changes we need to build more complex Flip-Flops
12 COS10004 Computer Systems 12
SUMMARY
- CPUs need storage to keep track of state and store computation outputs
- Flip Flops:
- Store single bits of data
- RS Flip Flop:
- Set / Reset
- Asynchronous therefore problematic
- We can do better! (next lecture we’ll see!)