Beruflich Dokumente
Kultur Dokumente
VHDL Training
8:30
VHDL Training
Cypress Divisions/Products
Product Divisions
MPD
Memory Product Division
MPD Overview Async SRAM Sync SRAM NoBL / QDR MoBL EPROM
DCD
DataCom Division DCD Overview FIFOs Dual Port ATM / Sonet Robo VME
TTD
Timing Technology Division TTD Overview FTG Clock Distribution Spread Spectrum
IPD
Interface Products Division IPD Overview PCI Bridge USB Development Tools
PLD
Programmable Logic Division PLD Overview Ultra 37000 Delta 39K Development tools
VHDL Training
Objectives
Upon completion of this training, your VHDL knowledge will enable you to: Implement efficient combinatorial and sequential logic Design state machines and understand implementation trade-offs Use hierarchy / Create reusable components Identify how VHDL will synthesize and fit into a PLD, CPLD and FPGA
VHDL Training
Objectives (contd.)
Upon completion of this training, you will be able to use Warp to: Compile and synthesize VHDL designs for programmable logic devices Create VHDL or Verilog timing simulation models for popular third party simulators. Target PLDs/CPLDs Simulate the resulting device with the Aldec full timing simulator Use the report file to determine operating frequency, setup time, clock to output delay, and device resource usage.
VHDL Training
Agenda
Intro, Why Use VHDL?, Design Flow VHDL Design Descriptions The Entity, Ports, Modes, Types Exercise #1 - Write an entity statement The Architecture, differing styles Concurrent and Sequential statements Processes: Signals vs. Variables VHDL Operators/Overloading/Inferencing VHDL Identifiers Exercise #2 - write an architecture Tri-State Logic, Don't Cares Warp GUI overview Exercise #3 - Design a bus controller
1998 Cypress Semiconductor, rev 3.2.3
Aggregates and Subscripts Registers, Latches and Implicit Memory Exercise #4 - Design a counter Lunch State Machines and State Encoding Exercise #5 - Design a state machine Design Hierarchy - components, pkgs, libraries Exercise #6 - Design a loadable counter hierarchy Generate Statement Multiplexing I/O pins Exercise #7 - DRAM output controller User defined attributes CPLD synthesis directives Miscellaneous Topics and Wrap-up
VHDL Training
Introduction
VHDL is used to: document circuits simulate circuits synthesize design descriptions Synthesis is the reduction of a design description to a lowerlevel representation (such as a netlist or a set of equations). This training course covers VHDL for PLD synthesis The course will at times draw upon the concepts of VHDL as a simulation language
VHDL Training
VHDL Training
VHDL Training
10
VHDL Training
Warp2/Warp3/Programming
Design Entry Schematic Simulation Design Compilation Text/FSM Front End
Synthesis Fitting
Design Verification
Back End
11
VHDL Training
12
VHDL Training
13
VHDL Training
The Entity
A BLACK BOX The ENTITY describes the periphery of the black box (i.e., the design I/O)
BLACK_BOX
rst
d[7:0] clk
q[7:0] co
14
VHDL Training
q[7:0]
co
15
VHDL Training
entity_name is an arbitrary name generics are used for defining parameterized components name is the signal/port identifier and may be a comma separated list for ports of identical modes and types mode describes the direction the data is flowing type indicates the set of values name may be assigned
1998 Cypress Semiconductor, rev 3.2.3
16
VHDL Training
Ports
The Entity (BLACK BOX) has PORTS
PORTS are the points of communication PORTS are usually the device pins PORTS have an associated name, mode, and type
17
VHDL Training
Port Modes
A ports MODE indicates the direction that data is transferred:
Entity
IN OUT INOUT
Data goes into the entity only Data goes out of the entity only (and is not used internally) Data is bi-directional (goes into and out of the entity)
BUFFER Data that goes out of the entity and is also fed-back internally
1998 Cypress Semiconductor, rev 3.2.3
18
VHDL Training
19
VHDL Training
20
VHDL Training
IEEE 1164
A package created to solve the limitations of the BIT type Nine values instead of just two ('0' and '1') Allows increased flexibility in VHDL coding, synthesis, and simulation STD_LOGIC and STD_LOGIC_VECTOR are used instead of BIT and BIT_VECTOR when a multi-valued logic system is required STD_LOGIC and STD_LOGIC _VECTOR must be used when tri-state logic (Z) is required To be able to use this new type, you need to add 2 lines to your code: LIBRARY ieee; USE ieee.std_logic_1164.ALL;
1998 Cypress Semiconductor, rev 3.2.3
21
VHDL Training
1164 Types
std_logic and std_logic_vector are the industry standard logic type for digital design Values for Simulation & Synthesis 0 -- Forcing 0 1 -- Forcing 1 Z -- High Impedance L -- Weak 0 H -- Weak 1 - -- Dont care Values for Simulation only (std_ulogic): U -- Uninitialized X -- Forcing Unknown W -- Weak Unknown
1998 Cypress Semiconductor, rev 3.2.3
22
VHDL Training
co
23
VHDL Training
Port D is a 12-bit bus, input only Port OE and CLK are each input bits Port AD is a 12-bit, three-state bi-directional bus Port A is a 12-bit bus, output only Port INT is a three-state output Port AS is an output also used internally
my_design d[11:0] oe clk
ad[11:0]
a[11:0] int as
24
VHDL Training
25
VHDL Training
The Architecture
Architectures describe what is in the black box (i.e., the structure or behavior of entities) Descriptions can be either a combination of Structural descriptions Instantiations (placements of logic-much like in a schematic-and their connections) of building blocks referred to as components Behavioral/Dataflow descriptions Algorithmic (or high-level) descriptions:
IF a = b THEN state <= state5;
26
VHDL Training
arch_name is an arbitrary name optional signal declarations are used for signals local to the architecture body (that is, not the entitys I/O). entity_name is the entity name statements describe the function or contents of the entity
27
VHDL Training
28
VHDL Training
29
VHDL Training
30
VHDL Training
a b
d f
c USE WORK.gatespkg.ALL; ARCHITECTURE archlogic OF logic IS SIGNAL d: std_logic; BEGIN Behavioral/Dataflow d <= a AND b; Structural g1: nor2 PORT MAP (c, d, f); END archlogic;
1998 Cypress Semiconductor, rev 3.2.3
g1
31
VHDL Training
32
VHDL Training
Module Generation
In Warp a package called std_arith is used to overload the arithmetic (+, -, etc.) and relational operators (=, /=, <, etc.,) for std_logic, std_logic_vector and integer types Using this package causes adders, counters, comparators, etc., to automatically replace the operators in the design. These are optimized for the target architecture and synthesis goal (area/speed) This is known as module generation
33
VHDL Training
Ultragen Synthesis
The VHDL code below describes a comparator
if (a = b)
then c <= 1; else c <= 0; Pre-optimized Circuits
Delta39k
Area
Adders Subtractors Multipliers Comparators Counters Shifters
Speed
Adders Subtractors Multipliers Comparators Counters Shifters
FLASH370i Ultra37000
end if;
Ultra37000
Warp chooses the best pre-optimized circuit to meet your design goals
1998 Cypress Semiconductor, rev 3.2.3
34
VHDL Training
VHDL Statements
There are two types of statements, Concurrent and Sequential
Concurrent Statements (means in parallel) Concurrent statements are executed concurrently (at the same time)
The order of concurrent statements is not important Most of the examples we have seen so far have been concurrent statements: Boolean Equations WHEN-ELSE Component instantiations
35
VHDL Training
With Sequential statements, the ORDER of the statements is important (example later)
Therefore, we use a process to mark the beginning and end of a block of sequential statements
Each completed process is considered to be one big concurrent statement (there can be many processes inside one architecture)
36
VHDL Training
37
VHDL Training
38
VHDL Training
Combinational Logic
Can be described with concurrent statements boolean equations when-else with-select-when component instantiations Can be described with sequential statements if-then-else case-when
39
VHDL Training
x <= (a AND NOT(s(1)) AND NOT(s(0))) OR (b AND NOT(s(1)) AND s(0)) OR (c AND s(1) AND NOT(s(0))) OR (d AND s(1) AND s(0)) ;
a b c d
mux
40
VHDL Training
WITH selection_signal SELECT signal_name <= value_1 WHEN value_1 of selection_signal, value_2 WHEN value_2 of selection_signal, ... value_n WHEN value_n of selection_signal, value_x WHEN OTHERS;
1998 Cypress Semiconductor, rev 3.2.3
41
VHDL Training
a b c d
mux
42
VHDL Training
More on with-select-when
You can use a range of values with int_value select x <= a when 0 to 3, b when 4 | 6 | 8 , c when 10 , d when others ;
43
VHDL Training
VHDL Training
a b c d
mux
45
VHDL Training
46
VHDL Training
47
VHDL Training
48
VHDL Training
if-then-else
4-1 mux shown below mux4_1: process (a, b, c, d, s) begin if s = 00 then x <= a ; elsif s = 01 then x <= b ; elsif s = 10 then x <= c ; else x <= d ; end if; end process mux4_1 ;
s
2
a b c d
mux
49
VHDL Training
50
VHDL Training
s
2
a b c d
mux
51
VHDL Training
clock
clock
1998 Cypress Semiconductor, rev 3.2.3
52
VHDL Training
Therefore, on the previous slide, two registers will be synthesized (c <= b will be the old b)
In some cases, the use of a concurrent statement outside the process will fix the problem, but this is not always possible So how else can we fix this problem ?
1998 Cypress Semiconductor, rev 3.2.3
53
VHDL Training
Variables
When a concurrent signal assignment outside the process cannot be used, the previous problem can be avoided using a variable Variables are like signals, BUT they can only be used inside a PROCESS. They cannot be used to communicate information between processes Variables can be of any valid VHDL data type The value assigned to a variable is available immediately Assignment of variables is done using a colon (:), like this:
c := a AND b;
1998 Cypress Semiconductor, rev 3.2.3
54
VHDL Training
clock
55
VHDL Training
Native Operators
Logical - defined for type bit, bit_vector, boolean* AND, NAND OR, NOR XOR, XNOR NOT Relational - defined for types bit, bit_vector, integer* = (equal to) /= (not equal to) < (less than) <= (less than or equal to) > (greater than) >= (greater than or equal to) * overloaded for std_logic, std_logic_vector
1998 Cypress Semiconductor, rev 3.2.3
56
VHDL Training
57
VHDL Training
Overloaded Operators
In VHDL, the scope of all of the previous operators can be extended (or overloaded) to accept any type supported by the language, e.g.,
-----
assume a declaration of a 16-bit vector as SIGNAL pc IS std_logic_vector(15 DOWNTO 0); then a valid signal assignment is pc <= pc + 3; assuming the '+' operator has been overloaded to accept std_logic_vector and integer operands
The std_logic_1164 package defines overloaded logical operators (AND, OR, NOT, etc.,) for the std_logic and std_logic_vector types In this training, you will learn to use overloaded operators, but not to define them
1998 Cypress Semiconductor, rev 3.2.3
58
VHDL Training
A Simple Counter
LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE WORK.std_arith.ALL; clk ENTITY count8 IS PORT ( clk: IN std_logic; count: BUFFER std_logic_vector(7 DOWNTO 0)); END count8 ; ARCHITECTURE arch_count8 OF count8 IS BEGIN upcount: PROCESS (clk) BEGIN IF clkEVENT and clk=1 THEN count <= count + 1; END IF; END PROCESS upcount; END arch_count8;
1998 Cypress Semiconductor, rev 3.2.3
count
59
VHDL Training
60
VHDL Training
61
VHDL Training
62
VHDL Training
63
VHDL Training
64
VHDL Training
Selecting a Device
Double click on Small PLDs Select C22V10 on the left and PALCE22V10-5JC on the right, then hit <finish>, then <yes>
65
VHDL Training
66
VHDL Training
Write an architecture that causes aeqb to be asserted when a is equal to b Multiple solutions exist
1998 Cypress Semiconductor, rev 3.2.3
67
9:30
VHDL Training
68
VHDL Training
aeqb
69
VHDL Training
70
VHDL Training
Produces the equation x = c To assign dont cares in VHDL: mysig <= '-'; 'X' means "unknown" and is not useful for synthesis
1998 Cypress Semiconductor, rev 3.2.3
71
VHDL Training
Comparing Vectors to Strings -more on don't cares Comparing "1101" to "11-1" will return FALSE Use std_match(a,"string") Must include std_arith package Example:
72
VHDL Training
73
VHDL Training
74
VHDL Training
Hierarchy Listing
Click on the centermost tab on the bottom of the left hand pane The project hierarchy will be displayed
75
VHDL Training
76
VHDL Training
77
VHDL Training
Pull-down Menus
Files Menu - Allows the opening or closing of files and projects, printing, and recalling of prior files and projects
78
VHDL Training
Pull-down Menus
Edit Menu - Typical Cut, Copy and Paste commands as well as Find, Replace and Search all files. Additionally, the editor and project user preferences dialog box can be selected.
79
VHDL Training
80
VHDL Training
Pull-down Menus
View Menu - Allows the user to select several viewing options such as viewing pane options and toolbars
Format Menu - Allows block comment / un-comment as well as the setting of tabs
81
VHDL Training
Pull-down Menus
Project Menu - Used to add and remove files from a project and perform library management. Additionally the user can select/change device types, set compiler options, set a project as the top level in a hierarchy as well as back annotate pins and nodes to a control file.
82
VHDL Training
Compiler Options
The Compiler options screen allows the user to choose generic attributes for his file such as area/speed and optimization effort, I/O voltage, slew rate and bus hold. Additionally technology mapping attributes can be set. Finally, the timing model output and test bench output formats can be selected.
83
VHDL Training
Pull-down Menus
Compile Menu - Allows the user to compile the selected file or the entire project. Templates Menu - The user can browse through VHDL constructs or place LPM modules within his VHDL code. Bookmarks Menu - Allows the user to add and recall bookmarks within his files.
Tools Menu - Launches the Jam Composer, Aldec Simulator and Aldec FSM Editor
1998 Cypress Semiconductor, rev 3.2.3
84
VHDL Training
Pull-down Menus
Window Menu - Allows positioning of files within the edit window as well as swapping between tabbed windows.
85
VHDL Training
gnd en(1)
nOE LE
control[7:0]
en(2) en(3)
en[0:3]
PLD
86
10:00
VHDL Training
Exercise #3
Use Warp to compile the VHDL design description of the truth table below:
Addr(1:0) nvalid
"00" "00" "01" "01" "10" "10" "11" "11" '0' '1' '0' '1' '0' '1' '0' '1'
Write the Architecture for the given Entity (next) Save design in file named ex3.vhd
87
VHDL Training
dir en
PLD
88
VHDL Training
89
VHDL Training
90
VHDL Training
91
VHDL Training
92
VHDL Training
93
VHDL Training
Signals can be pulled from larger vectors Good for grouping outputs as an alias Sizes on both sides of assignment must match
rw <= ctrl(0); ce <= ctrl(1); en(0) <= ctrl(2); highcount <= count(7 DOWNTO 4);
94
VHDL Training
0 0 0 0 0 0 1 0
1 1 1 1 0 1 1 1
0 0 1 0 0 0 0 0
0 1 1 1 1 1 1 1
0 1 1 1 0 1 1 1
95
VHDL Training
Synchronous Logic
PLDs work well in synchronous applications Two methods of creating synchronous logic Structurally instantiating components with registers Behaviorally Using a processes with a clock signal in the sensitivity list
96
VHDL Training
97
VHDL Training
98
VHDL Training
99
VHDL Training
This process is only sensitive to changes in clk, i.e., it will become active only when the clock transitions
1998 Cypress Semiconductor, rev 3.2.3
100
VHDL Training
This process is sensitive to changes in both clk and rst, i.e., it will become active during clock or reset transitions.
1998 Cypress Semiconductor, rev 3.2.3
101
VHDL Training
102
VHDL Training
q_out
103
VHDL Training
104
VHDL Training
ARCHITECTURE archregistered OF registered IS BEGIN flipflop: Mff generic map (lpm_width=>4,lpm_fftype=>lpm_dff) PORT MAP (data=>d,clock=>clk,enable=>one,q=>q); END archregistered;
105
VHDL Training
Implicit memory
Signals in VHDL have a current value and may be scheduled for a future value If the future value of a signal cannot be determined, a latch will be synthesized to preserve its current value Advantages: Simplifies the creation of memory in logic design Disadvantages: Can generate unwanted latches, e.g., when all of the options in a conditional sequential statement are not specified
106
VHDL Training
a c
IF a = '1'
THEN c <= b; END IF; END PROCESS im_mem; END archincomplete;
Note: the incomplete specification of the IF...THEN... statement causes a latch to be synthesized to store the previous state of c
1998 Cypress Semiconductor, rev 3.2.3
107
VHDL Training
a b
The conditional statement is fully specified, and this causes the process to synthesize to a single gate
1998 Cypress Semiconductor, rev 3.2.3
108
VHDL Training
109
VHDL Training
Exercise #4
Making use of the previous examples, write an entity/architecture pair for the following design:
ENC
COUNTER
DATA LD CLOCK
COUNT
4
COMPARATOR
P P=Q Q
RESET (sync)
REGISTER
110
11:00
VHDL Training
111
VHDL Training
112
VHDL Training
113
11:45
VHDL Training
114
VHDL Training
Attribute Attribute Attribute Attribute Attribute Attribute Attribute Attribute Attribute Attribute Attribute Attribute Attribute
PIN_NUMBERS PIN_NUMBERS PIN_NUMBERS PIN_NUMBERS PIN_NUMBERS PIN_NUMBERS PIN_NUMBERS PIN_NUMBERS PIN_NUMBERS PIN_NUMBERS PIN_NUMBERS PIN_NUMBERS PIN_NUMBERS
of of of of of of of of of of of of of
count(1) is "37" ; count(2) is "30" ; data(2) is "29" ; data(1) is "27" ; data(0) is "26" ; count(3) is "25" ; count(0) is "18" ; data(3) is "15" ; ld is "14" ; enc is "13" ; reset is "12" ; clock is 4" ; enr is 7" ;
115
VHDL Training
Lunch
116
12:00
VHDL Training
117
1:00
VHDL Training
118
VHDL Training
119
VHDL Training
120
VHDL Training
121
1:30
VHDL Training
Moore machines
Outputs may change only with a change of state Multiple implementations include: Arbitrary state assignment outputs must be decoded from the state bits combinatorial decode registered decode Specific state assignment outputs may be encoded within the state bits one-hot encoding
122
VHDL Training
R='1'
G='1'
Y='1'
TIMER3
123
VHDL Training
Inputs
Next State
State Registers
Output Logic
Outputs
Tco + tpd
1998 Cypress Semiconductor, rev 3.2.3
124
VHDL Training
IN IN std_logic;
125
VHDL Training
Example: Solution 1
Combinatorial outputs decoded from the state registers
ARCHITECTURE arch_1 OF state_machine IS TYPE traffic_states IS (red, yellow, green); -- enumerated type SIGNAL sm: traffic_states; BEGIN
fsm: PROCESS (clock, reset) -- the process describes the BEGIN -- state machine only IF reset = '1' THEN sm <= red; ELSIF rising_edge(clock) THEN CASE sm IS WHEN red => IF timer1=1 THEN sm <= green; ELSE sm <= red; END IF;
WHEN green => IF timer2=1' THEN sm <= yellow; ELSE sm <= green; END IF;
1998 Cypress Semiconductor, rev 3.2.3
126
VHDL Training
127
VHDL Training
Present State
Inputs
Outputs
tco
1998 Cypress Semiconductor, rev 3.2.3
128
VHDL Training
Example: Solution 2
Registered outputs decoded from the state registers
ARCHITECTURE arch_2 OF state_machine IS TYPE traffic_states IS (red, yellow, green); SIGNAL sm: traffic_states; BEGIN
fsm: PROCESS (clock, reset) -- the process describes the BEGIN -- state machine AND the outputs IF reset = '1' THEN sm <= red; r<=1; g<=0; y<=0; ELSIF rising_edge(clock) THEN CASE sm IS WHEN red => IF timer1=1 THEN sm <= green; r<=0; g<=1; y=0; ELSE sm <= red; r<=1; g<=0; y=0; END IF;
129
VHDL Training
WHEN yellow => IF timer3=1' THEN sm <= red; r<=1; g<=0; y<=0; ELSE sm <= yellow; r<=0; g<=0; y<=1; END IF; WHEN others => sm <= red; r<=1; g<=0; y<=0; END CASE; END IF; END PROCESS fsm; END arch_2;
1998 Cypress Semiconductor, rev 3.2.3
130
VHDL Training
Inputs
Logic
State Registers
Outputs
Tco
1998 Cypress Semiconductor, rev 3.2.3
131
VHDL Training
Example: Solution 3
Outputs encoded inside the state registers
ARCHITECTURE arch_3 OF state_machine IS SIGNAL CONSTANT CONSTANT CONSTANT sm: red: green: yellow: std_logic_vector(2 std_logic_vector(2 std_logic_vector(2 std_logic_vector(2 DOWNTO DOWNTO DOWNTO DOWNTO 0) 0) 0) 0) ; := 100" ; := "010" ; := "001" ;
BEGIN
fsm: PROCESS (clock, reset) -- the process describes the BEGIN -- state machine only IF reset = '1' THEN sm <= red; ELSIF rising_edge(clock) THEN CASE sm IS WHEN red => IF timer1=1 THEN sm <= green; ELSE sm <= red; END IF;
132
VHDL Training
WHEN yellow => IF timer3=1 THEN sm <= red; ELSE sm <= yellow; END IF; WHEN others => sm <= red; END CASE; END IF; END PROCESS fsm;
r <= sm(2); g <= sm(1); y <= sm(0); END arch_3;
1998 Cypress Semiconductor, rev 3.2.3
-- the outputs are just taken from -- the state machine registers -- (no decode logic required)
133
VHDL Training
134
VHDL Training
135
VHDL Training
TYPE traffic_states IS (red, yellow, green); -- enumerated type SIGNAL sm: traffic_states; ATTRIBUTE state_encoding OF traffic_states: TYPE IS one_hot_one;
BEGIN fsm: PROCESS (clock, reset) -- the process describes the BEGIN -- state machine only IF reset = '1' THEN sm <= red; ELSIF rising_edge(clock) THEN CASE sm IS WHEN red => IF timer1=1 THEN sm <= green; ELSE sm <= red; END IF; WHEN green => IF timer2=1' THEN sm <= yellow; ELSE sm <= green; END IF;
1998 Cypress Semiconductor, rev 3.2.3
136
VHDL Training
137
VHDL Training
138
VHDL Training
Mealy Machines
Outputs may change with a change of state OR with a change of inputs Mealy outputs are non-registered because they are functions of the present inputs
State Registers
Inputs
Logic
Outputs
139
VHDL Training
IDLE
RETRY
PWAIT
140
VHDL Training
END IF; WHEN retry => IF pwait = '1' THEN wait_gen <= idle; ELSE wait_gen <= retry; END IF; WHEN OTHERS => wait_gen <= idle; END CASE; END IF; END PROCESS fsm; retry_out <= '1' WHEN (wait_gen = retry AND enable='0') ELSE '0'; END archmealy1;
1998 Cypress Semiconductor, rev 3.2.3
141
VHDL Training
Exercise #5
Design a state machine to implement the function shown below:
hold
sample
extend
clear='0'
track='1'
track='1'
142
2:00
VHDL Training
143
VHDL Training
144
VHDL Training
145
VHDL Training
146
VHDL Training
147
VHDL Training
ARCHITECTURE archex5 OF ex5 IS TYPE states IS (hold, sample, extend); SIGNAL fsm: states; BEGIN clear <= '0' WHEN fsm=sample ELSE '1'; track <= '1' WHEN (fsm=extend or fsm=sample) ELSE '0';
148
VHDL Training
149
VHDL Training
150
VHDL Training
151
VHDL Training
ARCHITECTURE archex5 OF ex5 IS TYPE states IS (hold, sample, extend); SIGNAL fsm: states; ATTRIBUTE enum_encoding OF states: TYPE IS "10 01 11"; BEGIN clear <= '0' WHEN fsm=sample ELSE '1'; track <= '1' WHEN (fsm=extend or fsm=sample) ELSE '0';
1998 Cypress Semiconductor, rev 3.2.3
152
VHDL Training
153
VHDL Training
In the past, this was the major advantage of schematic capture tools
But, VHDL also supports hierarchical designs !!
154
2:45
VHDL Training
155
VHDL Training
156
VHDL Training
i
b sel
mux2to1
a c b sel symbol component
schematic entity/architecture
library package
157
VHDL Training
Hierarchy Management
Libraries are used to store re-usable components, type definitions,
overloaded operators etc. You add the LIBRARY and USE clauses to your code to get access to them
Your Design (VHDL)
LIBRARY ieee; USE ieee.std_logic_1164.. USE work.std_arith.all
Others (VHDL)
std_logic type definitions
Others (VHDL)
overloaded operators
work
std_arith
158
VHDL Training
159
VHDL Training
LIBRARY ieee; USE ieee.std_logic_1164.ALL; PACKAGE mymuxpkg IS COMPONENT mux2to1 PORT ( a, b, sel: IN std_logic; c: OUT std_logic); END COMPONENT; END mymuxpkg; LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY mux2to1 IS PORT ( a, b, sel: IN std_logic; c: OUT std_logic); END mux2to1;
ARCHITECTURE archmux2to1 OF mux2to1 IS BEGIN c <= (a AND NOT sel) OR (b AND sel); END archmux2to1;
1998 Cypress Semiconductor, rev 3.2.3
160
VHDL Training
161
VHDL Training
Schematic of example
mux2to1
i(2) a
t(0) i(1)
mux2to1
a
t(1) i(0)
mux2to1
a
t(2)
m0 c
r(0) b sel r(1) b
m1 c
sel r(2) b
m2 c
sel
162
VHDL Training
Exercise #6
Making use of exercise #4, we will use a separate entity/architecture for each block and use VHDL hierarchy
ENC
COUNTER
DATA LD CLOCK
COUNT
4
COMPARATOR
P P=Q Q
RESET (sync)
REGISTER
163
3:15
VHDL Training
Exercise #6 : Instructions
Write a hierarchical VHDL description of the previous schematic which instantiates all of the components shown in the design The entity/architecture is given for all 3 components count4.vhd, reg4.vhd, comp4.vhd Complete the package which has the component declarations for all 3 components package.vhd Complete the top level file which instantiates the 3 components and makes the interconnections ex6.vhd
1998 Cypress Semiconductor, rev 3.2.3
164
VHDL Training
165
VHDL Training
PACKAGE ex6_pkg IS
COMPONENT comp4 PORT ( p, q : IN std_logic_vector (3 DOWNTO 0); peqq : OUT std_logic); END COMPONENT; COMPONENT reg4 PORT ( clk, enr : IN std_logic; din : IN std_logic_vector(3 DOWNTO 0); q : OUT std_logic_vector(3 DOWNTO 0)); END COMPONENT;
166
VHDL Training
COMPONENT count4 PORT( clk, enc, ld, rst : IN std_logic; din : IN std_logic_vector(3 downto 0); q : BUFFER std_logic_vector(3 downto 0)); END COMPONENT; END ex6_pkg;
167
VHDL Training
: : : :
IN IN IN BUFFER
SIGNAL regout : std_logic_vector(3 downto 0); SIGNAL peqq : std_logic; SIGNAL not_peqq : std_logic;
1998 Cypress Semiconductor, rev 3.2.3
168
VHDL Training
U1: count4 PORT MAP (din=>data, ld=>load, enc=>not_peqq, clk=>clock, rst=>reset, q=>count); U2: reg4 PORT MAP (din=>data, enr=>enr, clk=>clock, q=>regout); U3: comp4 PORT MAP (count, regout, peqq); not_peqq <= enc AND NOT(peqq); END ex6_arch;
Positional Association
169
VHDL Training
Exercise 6: Summary
We created entity/architectures for each component. We stored those
components in a package so that we could RE-USE them We included ALL components in the ex6_pkg package which was compiled into the work library
Your Design (VHDL)
LIBRARY ieee; USE ieee.std_logic_1164.. USE work.ex6_pkg.all
Others (VHDL)
std_logic type definitions
170
VHDL Training
po(1)
po(0)
4:00
VHDL Training
LIBRARY ieee ; USE ieee.std_logic_1164.ALL; USE WORK.std_arith.all ; ENTITY ldcnt IS PORT ( clk, ld, oe: IN std_logic; count: INOUT std_logic_vector(7 DOWNTO 0)); END ldcnt; ARCHITECTURE archldcnt OF ldcnt IS SIGNAL int_count: std_logic_vector(7 DOWNTO 0); BEGIN cnt: PROCESS (clk) BEGIN IF RISING_EDGE(clock) THEN IF ld = '1' THEN int_count <= count; -- count as "IN" ELSE int_count <= int_count + 1; END IF; END IF; END PROCESS cnt ; outen: PROCESS (oe, int_count) BEGIN IF oe = '1 THEN count <= int_count ; -- count as "OUT" ELSE count <= (OTHERS => 'Z') ;-- count as "OUT" END IF ; -- equivalent to count <= "ZZZZZZZZ" END PROCESS outen; END archldcnt;
1998 Cypress Semiconductor, rev 3.2.3
172
VHDL Training
Exercise #7
Design a Moore Machine to implement the Output Enable Controller shown below:
68040
DRAM BANK A DRAM BANK B
DRAM BANK C
DRAM BANK D
Output Enable
DRAM Controller
Controller
173
skip
VHDL Training
RESET IDLE
OE=1111
/RAM
CHOOSE
OE=1111 /EOC /A3 AND /A2 /A3 AND A2 A3 AND /A2 A3 AND A2
BANK A
OE=1110
EOC
BANK B
OE=1101
EOC
BANK C
OE=1011
EOC
BANK D
OE=0111
EOC
174
VHDL Training
175
VHDL Training
BEGIN
176
VHDL Training
177
VHDL Training
178
VHDL Training
179
VHDL Training
180
VHDL Training
181
VHDL Training
182
VHDL Training
183
VHDL Training
184
VHDL Training
8-bit compare
a(3 DOWNTO 0)
b(3 DOWNTO 0)
mux
x(3 DOWNTO 0)
185
VHDL Training
Without synthesis_off
An implementation (without synthesis_off)
LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY mux IS PORT ( a, b: IN std_logic_vector(3 DOWNTO 0); c, d: IN std_logic_vector(7 DOWNTO 0); x: OUT std_logic_vector(3 DOWNTO 0)); END mux;
ARCHITECTURE archmux OF mux IS BEGIN x <= a WHEN (c = d) ELSE b; END archmux;
Resources used: 1092 product terms, 68 sum splits, 72 macrocells - the comparison is not done on a bit by bit basis
1998 Cypress Semiconductor, rev 3.2.3
186
VHDL Training
VHDL Training
With synthesis_off
A better implementation (with synthesis_off)
LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY mux IS PORT ( a, b: IN std_logic_vector(3 DOWNTO 0); c, d: IN std_logic_vector(7 DOWNTO 0); x: OUT std_logic_vector(3 DOWNTO 0)); END mux; ARCHITECTURE archmux OF mux SIGNAL sel: std_logic; ATTRIBUTE synthesis_off BEGIN sel <= '1' WHEN (c = d) x <= a WHEN (sel = '1') END archmux; IS OF sel:SIGNAL is TRUE; ELSE '0'; ELSE b;
188
VHDL Training
189
VHDL Training
190
VHDL Training
191
VHDL Training
192
VHDL Training
193
VHDL Training
194
VHDL Training
S_1
Buried Macrocell #2
6 PTs
S_2
2 PTs PIM
195
VHDL Training
S_1
196
VHDL Training
197
VHDL Training
198
VHDL Training
Warp2/Warp3/Programming
Design Entry Schematic Simulation Design Compilation Text/FSM Front End
Synthesis Fitting
Design Verification
Back End
199
VHDL Training
- Synopsys, Exemplar
PLD Development Tools - Data I/O Abel 4/5/6 and Synario, CUPL, LOG/iC, OrCAD Simulation Tools
200
VHDL Training
PC Parallel port
1998 Cypress Semiconductor, rev 3.2.3
ISR connector
201
VHDL Training
Jam Standard
Jam is an interpreted language optimized for programming PLDs via the IEEE 1149.1 (JTAG) interface Universal language for all programming platforms programmers PC based ISR ATE based ISR micro-controller based ISR Jam Composer creates Jam file with data and algorithm Jam Player interprets Jam file on host system
1998 Cypress Semiconductor, rev 3.2.3
202
VHDL Training
Benefits of Jam
Open standard 22 MB Vendor and Platform independent Smaller file sizes 790 KB 25KB JAM vs 120KB JEDEC vs 150 KB 790+KB vector files 25 KB Algorithm flexibility JAM SVF Vector JED Supports existing and future products Extendible to test Allows faster programming times
1998 Cypress Semiconductor, rev 3.2.3
203
VHDL Training
Jam Composer
Jam
Jam Player
Target Device
TDI
204
VHDL Training
And now, after all that good training that you just received, a quick message from our sponsor
(less than 10 minutes, really)
205
4:45
VHDL Training
Leadership CPLDs
500+
I/O
100 22V10 20V8 16V8
20
1,000 (32)
Gates
1998 Cypress Semiconductor, rev 3.2.3
206
VHDL Training
Ultra37000
Simply Faster CPLDs
32 to 512 Macrocells
207
VHDL Training
I/O
133 69 37
User Programmable Options Low Power Slew rate Clock polarity Bus-Hold Fast Programming Time (less than 5 seconds @ 256 macrocells)
32
64
128
Macrocells
208
192
256
384
512
VHDL Training
Primary Package PLCC, TQFP PLCC, TQFP PLCC, TQFP TQFP T/PLCC, BGA T/PLCC, BGA T/PLCC, BGA
209
VHDL Training
D/T/L Q
CLK
210
VHDL Training
11 37256-154
Tpd (ns)
10
6 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
211
VHDL Training
212
VHDL Training
Delta39K
Simply Bigger CPLDs
50 to 350K Gates 768 to 4000+ Macrocells
213
VHDL Training
HDPL2
ISR Very high density 0.18u SRAM technology Designed for core logic integration Dual Port RAM blocks High Speed Low Power Easy to Route 3.3V and 5V I/O JTAG, PCI
I/O 84
60
36
ISR 0.18u SRAM technology Dual Port RAM blocks High Speed, Low Power CPLD Architecture 3.3V and 5V JTAG, PCI
10K
20K
40K
100K
250K
500K
Gates
1998 Cypress Semiconductor, rev 3.2.3
214
VHDL Training
With the
Speed Ease-of-use Predictability Non-Volatility
of an FPGA
of a CPLD
215
VHDL Training
128 Macrocells 8 Logic Blocks (2) 8192-bit Memory blocks 144 Cluster outputs 72 to V channel 72 to H channel 128 Cluster inputs 64 from V channel 64 from H channel
LB
16
LB
16
36
36
LB
LB
16 16 72 64
Vertical Channel
36
LB
PIM
36 16
16
LB
36
36 16
LB
16
LB
Cluster Mem
25 8
25 8
Cluster Mem
64
216
72
VHDL Training
Delta39K Architecture
128 mcell clusters 8192 bit SRAM 4096 bit DPMem Flexible I/O
I/Os I/Os
LB LB
RAM
LB LB PIM
RAM
LB LB
RAM
LB LB PIM
RAM
LB LB
RAM
LB LB PIM
RAM
LB LB
8196 bit RAM
LB LB
128 MC Cluster
LB LB
LB LB
128 MC Cluster
LB LB
LB LB
128 MC Cluster
LB LB
LB LB
128 MC Cluster
RAM
RAM
RAM
LB LB
RAM
LB LB PIM
RAM
LB LB
RAM
LB LB PIM
RAM
LB LB
RAM
LB LB PIM
RAM
LB LB
RAM
LB LB
128 MC Cluster
LB LB
LB LB
128 MC Cluster
LB LB
LB LB
128 MC Cluster
LB LB
LB LB
128 MC Cluster
RAM
RAM
RAM
LB
PIM
LB
LB
PIM
LB
LB
217
VHDL Training
218
4:55
VHDL Training
219
VHDL Training
Latest news releases and product offerings Corporate information and employment opportunities Sales office directory Quality and Reliability Reports Product information First page of data sheets Selected application notes Entire document available for download
220
VHDL Training
221
VHDL Training
Design Centers
Purpose - Fitting new designs into Cypress silicon - Converting designs from other formats - Implementing USB support for peripherals, etc. How do you submit a design conversion? - Contact your local Cypress FAE Design centers currently located throughout North America, Europe, and Japan
222
VHDL Training
- 40+ Field Applications Engineers Worldwide - Nearly 200 Distribution/Rep FAEs - Customer Design Centers (PLDs and USB) World Wide Web http://www.cypress.com email support cyapps@cypress.com Applications Hotline (408) 943-2821 ftp (login as anonymous) www.cypress.com Literature fulfillment 1-800-858-1810
223
VHDL Training
Appendix A
224
VHDL Training
Reserved Words
abs access after alias all and architecture array assert attribute begin block body buffer bus case component configuration constant disconnect downto else elsif end entity exit file for function generate generic group guarded
225
VHDL Training
Reserved Words
map mod nand new next nor not null of on open or others out package port postponed procedure process pure range record register reject rem report return rnod rol ror select severity shared
226
signal sla sll sra srl subtype then to transport type unaffected
5:00