CY3130R62 Cypress Semiconductor Corp., CY3130R62 Datasheet - Page 3

no-image

CY3130R62

Manufacturer Part Number
CY3130R62
Description
Warp Enterprise VHDL PC
Manufacturer
Cypress Semiconductor Corp.
Datasheet
ARCHITECTURE fsm OF drink IS
TYPE drinkState IS (zero,five,ten,fifteen,
twenty,twentyfive,owedime);
SIGNAL drinkstatus:drinkState;
BEGIN
PROCESS BEGIN
END FSM;
VHDL is a strongly typed language. It comes with several
predefined operators, such as + and /= (add, not-equal-to).
VHDL offers the capability of defining multiple meanings for
operators (such as +), which results in simplification of the
code written. For example, the following code segment shows
that “count <= count +1” can be written such that count is a
std_logic_vector, and 1 is an integer.
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE work.std_arith.all;
Document #: 38-03050 Rev. *A
WAIT UNTIL clock = ’1’;
giveDrink <= ’0’;
returnDime <= ’0’;
returnNickel <= ’0’;
CASE drinkStatus IS
WHEN zero =>
WHEN five =>
-- Several states are omitted in this
-- example. The omitted states are ten,
-- fifteen, twenty, and twentyfive.
WHEN owedime =>
when others =>
-- This makes sure that the state
-- machine resets itself if
-- it somehow gets into an undefined state.
END CASE;
END PROCESS;
IF (nickel = ’1’) THEN
ELSIF (dime = ’1’) THEN
ELSIF (quarter = ’1’) THEN
END IF;
IF (nickel = ’1’) THEN
ELSIF (dime = ’1’) THEN
ELSIF (quarter = ’1’) THEN
END IF;
returnDime <= ’1’;
drinkStatus <= zero;
drinkStatus <= zero;
drinkStatus <= five;
drinkStatus <= Ten;
drinkStatus <= twentyfive;
drinkStatus <= ten;
drinkStatus <= fifteen;
giveDrink <= ’1’;
drinkStatus <= zero
ENTITY sequence IS
end sequence;
ARCHITECTURE fsm OF sequence IS
SIGNAL count: std_logic_vector(3 downto 0);
BEGIN
PROCESS BEGIN
END PROCESS;
END FSM;
In this example, the + operator is overloaded to accept both
integer and std_logic arguments. Warp Enterprise supports
overloading of operators.
Functions
A major advantage of VHDL is the ability to implement func-
tions. The support of functions allows designs to be reused by
simply specifying a function and passing the appropriate
parameters. Warp Enterprise features some built-in func-
tions such as ttf (truth-table function). The ttf function is
particularly useful for state machine or look-up table de-
signs. The following code describes a seven-segment dis-
play decoder implemented with the ttf function:
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE work.table_std.all;
ENTITY seg7 IS
END SEG7;
ARCHITECTURE mixed OF seg7 IS
CONSTANT truthTable:
-- input&
-- -----------------------
port (clk: in std_logic;
WAIT UNTIL clk = ’1’;
PORT(
);
ttf_table (0 to 11, 0 to 10) := (
”0000”& ”0111111”,
s : inout std_logic);
CASE count IS
END CASE;
inputs: IN STD_LOGIC_VECTOR (0 to 3)
outputs: OUT STD_LOGIC_VECTOR (0 to 6)
WHEN x“0” | x“1” | x“2” | x“3” =>
WHEN x“4” | x“5” | x“6” | x“7” =>
WHEN x“8” | x“9” =>
WHEN others =>
s <= ’1’;
count <= count + 1;
s <= ’0’;
count <= count + 1;
s <= ’1’;
count <= count + 1;
s <= ’0’;
count <= (others => ’0’);
output
CY3130
Page 3 of 7

Related parts for CY3130R62