The following will be discussed in this chapter: Datapaths must deal with input and output data values, necessary to control external interfaces, some datapaths require decision making, moving towards software, understanding the data and control path.
Trang 1Lecture 32
Datapath Analysis
Trang 2w
° Datapaths must deal with input and output data values
• Implement with tri-state buffers
° Necessary to control external interfaces
• Perform repetitive operations
° Some datapaths require decision making
• Control outputs implemented in ROM
° Moving towards software
• Control implemented as a series of instructions
° Understanding the data and control path
Trang 3Datapath I/O
° A wire can be driven by only one tri-state at a time
• If InPass is active, AluPass must be inactive
• If AluPass is active, InPass must be inactive
Trang 4Datapath I/O
° Two values enter from the left (A and B)
• Need to perform (A+B)+A
Trang 5Implementing the Control
ROM
° Two values enter from the left (A and B)
• Need to perform (A+B)+A
• In -> X (Load A) - State 00
• In -> Y (Load B) - State 01
• A+B -> Y - State 10
• (A+B)+A -> Out - State 11
PS NS Function LoadX LoadY InPass AluPass OutPass
00 01 000 1 0 1 0 0
01 10 000 0 1 1 0 0
10 11 011 0 1 0 1 0
11 00 011 0 0 0 1 1
PS
NS
0100010100 1000001100 1101101010
00 01 10 ROM
Control outputs
0001100011 11
Addr
Trang 6More Complicated
Example
° Can we compute (A+B) (A-B)?
° Currently, no place for intermediate storage
° Solution: Add RAM to datapath.
Trang 7More Complicated
Example
° Can we compute (A+B) (A-B)?
• Need to add intermediate storage.
Add RAM to the Datapath
Trang 8Implementing the Control ROM
° Two values enter from the left (A and B)
• Need to perform (A+B) (A-B)
• In -> X (Load A) - State 000
• In -> Y (Load B) - State 001
• A+B -> RAM[4] - State 010
• A-B -> X - State 011
• RAM[4] ->Y - State 100
• (A+B) (A-B) ->Out - State 101
PS NS Function LoadX LoadY InPass AluPass OutPass Addr Read Write
Trang 9Does the Value of the Data
Matter?
° Problem: Add A to itself until overflow occurs
• Amount of steps depends on A
How can we determine if overflow occurred?
OF
Trang 10Implementing the Control ROM using Conditions
° One value enters from the left
Add A to itself until overflow occurs
• In -> X, Y (Load A, B) - State 0 - Next state 1
• X+Y -> Out, X - State 1 - Next state (1 if no overflow, 0 if overflow)
Include overflow (OF) bit as a ROM input Note that it doubles the size of the ROM
PS OF NS Function LoadX LoadY InPass AluPass OutPass Addr Read Write
0 0 1 000 1 1 1 0 0 000 0 0
0 1 1 000 1 1 1 0 0 000 0 0
1 0 1 011 1 0 0 1 1 000 0 0
1 1 0 011 1 0 0 1 1 000 0 0
Trang 11Implementing the Control ROM with Conditionals
° Control path may have
00 01 10 ROM
Trang 13Implementing the Control ROM
° Perform memory reads and writes
• RAM[0] -> X - State 00
• RAM[1] -> Y - State 01
• X+Y -> RAM[2] - State 10
PS NS Function LoadX LoadY InPass AluPass OutPass Addr Read Write
00 01 000 1 0 0 0 0 000 1 0
01 10 000 0 1 0 0 0 001 1 0
10 00 011 0 0 0 1 0 010 0 1
No interaction with outside interfaces (In, Out) is required
Very similar to microprocessor operations
Trang 14Processor Construction Kit
Data Path Control Signals
Subproblem 2: CONTROL
Trang 15Processor Compilation
° Software engineer writes C program
° Compiler software converts C to assembly code
° Assembler converts assembly code to binary format
ST R3, C ; Store result in C Assembly program
A, B, and C are storage locations in main memory (DRAM)
Trang 16• Each row in the state table corresponds to a word in the ROM
° Multiple rows for each state if the ROM has a control
input (e.g ALU overflow)
Trang 17Recap after Combinational Logic
Trang 18Sequential Logic (Why) ?
° Sequential circuit has additional dimension which
is time
° Combinational logic only depends on current
input
° Sequential circuit output depends on previous
input other than current input
° More powerful than combinational logic
° Able to model condition that can’t be
accommodated by combinational logic
Trang 19Sequential Circuits: Latches
° Circuits require memory to store intermediate data
° Sequential circuits use a periodic signal to determine when to store values.
• A clock signal can determine storage times
• Clock signals are periodic
° Single bit storage element is a flip flop
° A basic type of flip flop is a latch
° Latches are made from logic gates
• NAND, NOR, AND, OR, Inverter
Trang 20Sequential Circuits: Latches
° Latches are based on combinational gates (e.g NAND, NOR)
° Latches store data even after data input has been
removed
° S-R latches operate like cross-coupled inverters with control inputs (S = set, R = reset)
° With additional gates, an S-R latch can be converted to
a D latch ( D stands for data )
° D latch is simple to understand conceptually
• When C = 1 , data input D stored in latch and output as Q
• When C = 0 , data input D ignored and previous latch value output at Q
Trang 22Sequential Circuits: Flip flops
° The most fundamental sequential components are the latch and flip-flop
° They store one bit of data and make it available to other components
° The main difference between a latch and a flip-flop
is that the first are level triggered and the latter are edge triggered
° Flip-flops and latches have a clock input
Trang 23Sequential Circuits: Flip flops
° Flip flops are powerful storage elements
• They can be constructed from gates and latches!
° D flip flop is simplest and most widely used
° Asynchronous inputs allow for clearing and presetting the flip flop output
° Multiple flops allow for data storage
• The basis of computer memory!
° Combine storage and logic to make a computation
circuit
Trang 25Combinational vs Sequential
Combinational Logic Circuit
Output is a function only of the present
inputs.
Sequential Logic Circuit (Finite State Machine)
Output is a function of the present state and
at times present state and input.
Trang 26Synchronous vs Asynchronous
Synchronous Sequential Logic Circuit
All Flip-Flops use the same clock and
change state on the same triggering edge.
Asynchronous Sequential Logic Circuit
Trang 28° Registers also allow for parallel transfer
• Many bits transferred at the same time
° Shift registers can be used with adders to build
arithmetic units
° Remember: most digital hardware can be built from
combinational logic (and, or, invert) and flip flops
• Basic components of most computers
Trang 29Shift Registers
° Shift registers can be combined together to allow for data transfer
° Serial transfer used in modems and computer
peripherals (e.g mouse)
° D flip flops allow for a simple design
• Data clocked in during clock transition (rising or falling edge)
° Serial addition takes less chip area but is slow
° Universal shift register allows for many operations
• The register is programmable.
• It allows for different operations at different times
Trang 31° Counters are important components in computers
• The increment or decrement by one in response to input
° Two main types of counters
• Ripple (asynchronous) counters
• Synchronous counters
° Ripple counters
• Flip flop output serves as a source for triggering other flip flops
° Synchronous counters
• All flip flops triggered by a clock signal
° Synchronous counters are more widely used in
industry.
Trang 32° Counter: A register that goes through a prescribed series of states
° Binary counter
• Counter that follows a binary sequence
• N bit binary counter counts in binary from n to 2 n-1
° Ripple counters triggered by initial Count signal
Trang 34° Sequential circuits require a periodic clock
° Goal: analyze clock circuit to determine maximum clock frequency
• Requires analysis of paths from flip-flop outputs to flip-flop inputs
° Even after inputs change, output signal of circuit
maintains original output for short time
Trang 35Timing Analysis
° Maximum clock frequency is a fundamental parameter
in sequential computer systems
° Possible to determined clock frequency from
propagation delays and setup time
° The longest path determines the clock frequenct
° All flip-flop to flip-flop paths must be checked
° Hold time are satisfied by examining contamination
Trang 37° Memory is a collection of storage cells with associated input and output circuitry
• Possible to read and write cells
° Random access memory (RAM) contains words of
information
° Data accessed using a sequence of signals
• Leads to timing waveforms
° Decoders are an important part of memories
• Selects specific data in the RAM
° Static RAM loses values when circuit power is
removed.
Trang 39Read-Only Memory (ROM)
° Read-only memory can normally only be read
° Internal organization similar to SRAM
° ROMs are effective at implementing truth tables
• Any logic function can be implemented using ROMs
° Multiple single-bit functions embedded in a single ROM
° Also used in computer systems for initialization
• ROM doesn’t lose storage value when power is removed
° Very useful for implementing FSMs
Trang 40° Data can be read but not changed
• (normal operating conditions)
Data is written to the ROM once, and read from the ROM many times.
A read-only memory (ROM) consists of an array of
semiconductor devices that are interconnected to store a set
of binary data.
Once binary data is stored in the ROM, it can be read out
Trang 41° A ROM table is basically just a truth table.
• The table shows what data is stored at each ROM address.
• You can generate that data combinationally, using the address as the input.
Trang 43Programmable Logic Array
° A ROM is potentially inefficient because it uses a
decoder, which generates all possible minterms
No circuit minimization is done.
° Using a ROM to implement an n-input function
° A programmable logic array, or PLA, makes the
decoder part of the ROM “programmable” too
Instead of generating all minterms, you can choose which products (not necessarily minterms) to
generate.
Trang 45° Main computation unit in most computer systems
° ALUs perform a variety of different functions
• Add, subtract, OR, AND…
° Example: ALU chip (74LS382)
• Has data and control inputs
° Individual chips can be chained together to make larger ALUs
° ALUs are important parts of datapaths
• ROMs often are used in the control path
° Build a data and control path
Trang 46Circuit Maker Simulator
° Circuit Implementation using Computer