Lecture 8
Lecture 8
19.11.2023
Content today
Both Arrays:
the AND Array and
the OR Array
are programmable
• Logic Array Blocks (LABs) are fabricated on a single chip and the LABs
are interconnected by a programmable switch structure.
• The switch structure is called switch matrix or Programmable Interconnect
Array (PIA). User inputs to CPLD are routed through switch matrix to
LABs. The outputs of LABs are the outputs of CPLD and they are also
routed through the switch matrix.
• User inputs to CPLD are the requirements of logic circuits for new designs.
• The output of CPLD is the simplified logic function.
10
11
I/O block
Programmable interconnect
Programmable
Example: 2-LUT for “AND”
Latch Input 1 Input 2 Output
6-Input 0 0 0
Look-Up
0 1 0
Table
1 0 0
FF
1 1 1
Sequential circuit
LUT construction
Dr. Moheb Mekhail © Gehad Alkady
How to implement Logic functions using LUTs?
• LUT with k inputs could be programmed to implement any Boolean function
with k variables and it requires 2k SRAM bits.
• To implement a LUT with k inputs use a 2k “:1 Multiplexer
Example:
• assume number of inputs = k = 3
• → 2k = 8
• → use 8:1 MUX
17
18
19
20
21
22
24
Tri (three-state) − here all drivers connected to a tri must be z, except only one
(which determines value of tri).
28
29
Examples:
reg c; // single 1-bit register variable
reg [5:0] gem; // a 6-bit vector;
reg [6:0] d, e; // two 7-bit variables
30
31
Example:
Integer c; // single 32-bit integer
Assign d=63; // 63 defaults to a 7-bit variable.
32
Example:
supply0 logic_0_wires;
supply0 gnd1; // equivalent to a wire assigned as 0
supply1 logic_1_wires;
supply1 c, s;
33
Example:
time time_variable_list;
time c;
c = $time; // c = current simulation time
34
Example:
Parameter add = 3’b010, sub = 2’b11;
Parameter n = 3;
Parameter [2:0] param2 = 3’b110;
35
36
reduction AND
Module chk_zero (x, z);
Input [2:0] x;
Output z;
Assign z = & x; // Reduction AND
End module
37
Example:
38
Example:
Wire [1:0] a, f; wire [4:0] x;
Assign x = {2{1’f0}, a}; // Equivalent to x = {0,0,a }
Assign y = {2{a}, 3{f}}; //Equivalent to y = {a,a,f,f}
39
40
Examples:
if, else, for, repeat,
and, nand, or, not
input, output, wire
join, module, wait
41
42
45
47
always [@ (senstivity_list)]
begin
//[timing control]
//procedural assignments;
end
48
49
OUTPUT:
a=00
b=00
c=00
50
51
OUTPUT:
a=01
b=10
c=11
52