Professional Documents
Culture Documents
Initial <output_terminal_name>=<value>;
//UDP state table
table
<table entries>
endtable
//end of UDP defination
UDP RULES
1. UDPs can take only scalar input terminals(1 bit). Multiple input terminal are permitted. 2. UDPs can have only one scalar output terminal(1 bit). The output terminal must always appear first in the terminal list. Multiple output terminals are not allowed. 3. In the declaration section, the output terminal is declared with the keyword output. Since sequential UDPs store state, the output terminal must also be declared as a reg. 4. The inputs are declared with the keyword input.
5. The state in a sequential UDP can be initialized with an initial statement. This statements is optional. A 1 bit value is assigned to the output, which is declared as a reg. 6.The state table entries can contain values 0,1, or x. UDPs do not handle z values passed to a UDP are treated as x values. 7. UDPs are defined at the same level as modules. UDPs cannot be defined inside modules. They can be instantiated only inside modules. UDPs are instantiated exactly like gate primitives. 8. UDPs do not support inout ports
Combinational UDps
Combinational UDPs takes the inputs and produce the output value by looking up the corresponding entry in the state table. Combinational UDP definition :The satte table is the most important part of the UDP definition. E.g. and gate primitive and call it UDP_and.
Note: ANSI C style decalration for UDPs are also supported. This style allows the declaration of a primitive ports to be combined with the port list. E.g. primitive udp_and ( output out, input a, input b) --------endprimitive
NOTE
1. The <input#> vaklues in a sttae table entry must appear in the same order As they appear in the input terminal list.It is important to keep this in mind while designing UDPs, because deasigner frequently make mistake in the input order and get incorrect result. Input and output are separated by a :. A state table entry ends with a ;. All possible combinations of inputs. Where the output produces a known value, must be explicitly specified. Otherwise, if a certain combination occur and the corresponding entry is not in the table, the output is x. use of default x output is frequently used in commercial models. Note that the table for udp_and does not handle the case when a or b is x.
2. 3. 4.
Note
The table for udp_and does not handle the case when a or b is x. Completely specify all possible cases. The values z is not allowed in a UDP. The z values on inputs are treated as x values.
primitive udp_or(y,a,b); output y; input a,b; table // a b : y 0 0 : 0; 1 ? : 0; // ? Expanded to 0,1,x. ? 1 : 0; 1 1 : 1; x 1 : 1; 1 x : 1; endtable endprimitive
Program
Write a program for 4 to 1 mux.
Sequential UDPs
4. There are 3 sections in a state table entry inputs, current state and next state. the 3 sections are separated by a colon(:) symbol. 5. Input specification of state table entries can be in terms of input levels or edge transitions. 6. The current state is the current value of the output register. 7. The next state is computed based on input and current state .The next state becomes the new value of the output registers. 8. All possible combinational of inputs must be specified to avoid unknown values.
If a sequential UDP is sensitive to input levels ,it is called level sensitive sequential UDP. If a sequential UDP is sensitive to edge transition on input ,it is called edge sensitive sequential UDP.
primitive d_lat(q,d,clk); output q; reg q; input d,clk; initial q = 0; table // d clk : q : q+ ? 0 : ? : -; 0 1 : ? : 0; 1 1 : ? : 1; endtable endprimitive
E.g. primitive dff(q,d,clk); output q; reg q; input d,clk; initial q = 0; table // d clk : q : q+ (??) ?: ? : -; ? (1?): ? : -; ? (?0): ? : -; ? (0x): ? : -; ? (x1): ? : -; 0 (01): ? : 0; 1 (01): ? : 1; endtable endprimitive
Note
(10)denotes a negative edge transition from logic 1 to logic 0. (1x)denotes a transition from logic 1 to unknown x state. (0?)denotes a transition from 0 to 0,1 or x. potential positive edge transition. (??)denotes any transition in signal value 0,1,or x to 0,1 or x. only one edge specification in a single table entry is allowed.
Shorthand symbol
? b -
Meaning
0,1,x 0,1 No change in state value
explanation
Cannot be specified in an output field Cannot be specified in an output field Can be specified only in output field of a sequential UDP
r
f p n *
(01)
(01) (01),(0x) or(x0) (10),(1x) or(x0) (??)
Program
Write a program for t F/F with UDP. Write a program for jk F/F with UDP.