functional model

advertisement
Functional Modeling
Contents
• Introduction of functional model
• Different Functional Models
– Truth table
– Primitive cube
– Binary Decision Diagram
– Programming model
– RTL model
Functional Model Introduction
• A functional model of a digital system is a representation of its logic
function.
• Any digital system can be represented by a black box which
processes the input to produce its output.
• The value of the outputs vary with inputs and a certain delay exists
• The logic function is the input-output mapping that deals with the
value transformation.
Functional modeling
•
•
•
•
•
Tells the relationship between input and output values of a circuit.
It does not talk about any timing aspect.
Simulation implies calculation of the output (response) of a circuit.
Functional models provide the information for simulation.
It can be done at two levels
– Logic level
– RTL(program) level
Different Functional Models
•
•
•
•
•
Truth tables
Primitive cubes
Binary decision diagrams
Programming model
RTL model
Truth table
• Representation of the function in terms of rows and columns.
– The rows represent inputs and the corresponding outputs.
– Columns are input and output variables.
• It is the simplest way to represent a circuit.
• In Boolean arithmetic, the possible values are 0 and 1. So for an ninput gate,
number of possible outcomes = 2n
• The inputs are given in an increment of 1 from 0 to 2n-1 in Boolean
form.
How the truth table is
constructed??
•
•
•
•
•
Assume there are n inputs (x1,x2,…,xn)
There are 2n different possible input vectors.
Start the first row with (0,0,…,0) as inputs.
Write the corresponding outputs in the same row.
Increment the input vector value by 1 in the subsequent rows and
enter the outputs.
• Follow this till the last 2n th vector (1,1,…,1) is reached
Example of a truth table
A
B
C
Out
0
0
0
0
0
0
1
0
0
1
0
1
0
1
1
0
1
0
0
0
1
0
1
1
1
1
0
0
1
1
1
0
Out = AB’C + A’BC’
Primitive Cubes
• Primitive cubes are compressed form of truth tables.
• Observe the truth table of AND gate given below:
A
B
Out(AND)
0
0
0
0
1
0
1
0
0
1
1
1
• Have a look at the first two inputs:
A=0, then out=0 irrespective of the second input B.
For these two input vectors, we call the B input as don’t care.
Primitive cube examples
A
B
Out(AND)
A
B
Out(AND)
0
0
0
0
X
0
0
1
0
1
0
0
1
0
0
1
1
1
1
1
1
Primitive cube of AND gate
Truth table of AND gate
X is don’t care
A
B
Out(NOR)
A
B
Out(NOR)
0
0
1
0
0
1
0
1
0
0
1
0
1
0
0
1
X
0
1
1
0
Truth table of NOR gate
Primitive cube of NOR gate
Binary Decision diagram(BDD)
• Is there any other way to reduce the number of entries for
describing the circuit?
– Yes, BDD.
•
•
•
•
One can determine the output by simple graph traversal procedure.
There are decision nodes and terminal nodes.
Each decision node will have two child nodes: 0-child, 1-child.
At every node, follow the left or the right branch depending upon
the value (0 or 1) of the corresponding decision node.
Example
• The dotted lines represent a 0-child and solid lines represent 1-child
• According to the given inputs traverse down to the exit terminal.
• Ex: x1=1,x2=0,x3=1
Since x1=1 select the solid line to x2,
then x2=0 so select the dotted line to x3, and
since x3=1 chose the solid line from x3 which leads to the exit
terminal and reflects the output as 1.
How to construct BDD??
• Start the tree with one of the inputs, say x1.
• X1 can be 0 or 1, so map these two possible cases to the next input,
say x2.
• Follow the same procedure for x2 and all the other inputs.
• Follow till you reach the exit terminal (no more inputs to map).
• Point the exit terminals to 0 or 1 looking at truth table.
• Binary decision diagram is built.
• This diagram can be simplified leading to reduction in the input
entries.
Reduced Ordered BDD (ROBDD)
• Observe the complete BDD of the example from exit terminals.
• Both branches from the left most node x3 results in the same value
1, we remove this node and replace it by an exit branch with value
1.
• Similarly the next node x3 can be replaced by 0.
Reduced BDD
ROBDD contd…
• Observe the two left most exit terminals
– they are the inverted values of its parent node, so the left x2 node can be
replaced by x2.
• Similarly the node x3 which is to the left of x2 can be replaced by x3
• The two right most exit terminals can be removed, since they are
the same as their parent node.
• The dot represents the inverter.
Programming model
• All the combinational elements in a circuit can be represented in a
programming model.
• Any logic function is expressed in terms of basic logic operations
namely
–
–
–
–
NOT
AND,NAND
OR,NOR
EXOR,EXNOR
• Code based programs can be written for any digital circuit using the
above operations.
• Assembly coding is an example of programming model.
Example of programming model
E
F
G
LDA A //Load A in accumulator
XOR B
// A xor B
STA E
// Store A xor B in E
XOR C
// A xor B xor C
STA Sum
// store it in Sum
LDA E
AND C
STA F
LDA A
AND B
STA G
LDA F
OR G
STA Cout
Register Transfer Language(RTL) Model
• RTL- A kind of hardware description language (HDL)
• It is used in describing the registers of a computer or digital
electronic system, and the way in which data is transferred between
them.
• In computer, data words are stored in registers and memories are
organized as arrays of registers.
• For example :
– register A[0:7]
– memory M[0:7;0:255]
// A is a 8 bit register
// A 256 array of 8 bit register
• RTLs provide models for systems at the register and instruction set
levels.
RTL model
• In this we make HDL models of registered circuits and how signals
interact between them such as memories, flip flops, latches, shift
registers, and so on.
• RTL codes are fully synthesizable(can be realized in hardware),
because they are written using basic HDL structures.
• RTL models are characterized as functional, because they
emphasize functional description while providing only summary
about structural circuits.
Example of RTL model
E
E = A XOR B
F = E AND Cin
G = A AND B
S = E XOR Cin
Cout = F OR G
F
G
• Here A, B, Cin are input registers and Cout, S are the output
registers. E, F, and G are intermediate registers
RTL detail
• Primitive operator : This describes the processing and transfer of
data. Example
C=A+B
• Conditional operator : Control of data transformation.
For example : if (x) then c = A + B
• Case operator : This is used for multiway decision. Example :
signal{X[0:1]}
case 0 : C = A + B;
……….
case 3 : C = A – B;
Thank You
Download