FSM(5)
โจ FSM(5) โ the Alliance VHDL Finite State Machine description subset โจ
okay so bestie ๐ซถ you want to describe a finite state machine in the Alliance VHDL subset? this page โ fsm, section 5 of the manual โ is literally the whole blueprint. it's giving very specific rules, and we're gonna go through every single one. no skipping. periodt ๐
๐ ORIGIN ๐
This software belongs to the ALLIANCE CAD SYSTEM, developed by the ASIM team at LIP6 laboratory of Universitรฉ Pierre et Marie CURIE, in Paris, France. ๐ซ๐ท iconic behavior honestly.
- Web :
http://asim.lip6.fr/recherche/alliance/ - E-mail :
alliance-users@asim.lip6.fr
๐ DESCRIPTION ๐
This document describes the Alliance VHDL subset for Finite State Machine description. that's the whole vibe.
โ ๏ธ heads up bestie: this FSM subset is neither accepted by the logic simulatorasimut(1), nor the formal proverproof(1). like. it does NOT vibe with those tools. don't try it. ๐ญ
This VHDL subset is defined to enable classical MOORE and MEALEY synchronous finite state machine description, plus stack FSM description too (peep syf(1) if you wanna know more about that flavor of FSM).
A FSM description is made of two and only two processes. not three. not one. TWO. ๐
Connectors and signals can only be of in, out, and two user defined enumerated types. Vectors of in and out types are also allowed, so go off.
FSM's states and stack control signals must be declared as enumerated type. non-negotiable.
For the scan-path, three more signals are required:
scan_test:in bitscan_in:in bitscan_out:out bit
For a ROM implementation, the vdd and vss signals must be explicitly declared as:
rom_vdd:in bitrom_vss:in bit
These signals, declared in the interface, are not used or assigned in the FSM description. they just exist. they're the background characters ๐
The -P option of syf(1) allows scan-path implementation.
๐ฎ Pragmas ๐ฎ
A pragma is a comment that gives necessary information to the synthesis and formal proof tools. it's how you whisper secrets to the toolchain, iykyk.
Three pragmas are used, their generic names are:
CLOCKโ External clock signal name.CURRENT_STATEโ Current State name.NEXT_STATEโ Next State name.
Ten other pragmas are optional. โจ
Three pragmas are required only for scan-path implementation:
SCAN_TESTโ Enable test mode (scan-path).SCAN_INโ scan-path input.SCAN_OUTโ scan-path output.
Five others are used only in a STACK FSM:
RETURN_STATEโ Return State name.CONTROLโ Stack Control signal name.POPโ POP operation on the stack.PUSHโ PUSH operation on the stack.NOPโ NOP operation on the stack.
The last ones, for ROM implementation:
ROM_VDDโ Name of the vdd signal of the ROM.ROM_VSSโ Name of the vss signal of the ROM.
๐ The two processes ๐
Two different processes are used:
- The first process, called the state process, allows to describe state transition and outputs generation. It is not controlled by the clock. The state process sensitivity list contains inputs and
CURRENT_STATEโ which means the state process is activated when theCURRENT_STATEor an input signal changes. Acasestatement is used to describe, for each state, the next state and outputs. - The second process is controlled by the clock and describes the state register and stack registers modifications. Its sensitivity list contains the clock signal, so this process is enabled whenever clock changes.
Both Level sensitive latches, and edge triggered flip flops can be used for state registers and stack implementation. your choice, slay ๐
๐งช EXAMPLE ๐งช
here's the whole thing, verbatim, because you deserve the real deal:
Entity FSM_EX is
port(
ck : in bit ;
reset :in bit;
t_mode:in bit;
s_in :in bit;
i :in bit;
s_out :out bit;
o :out bit
);
End FSM_EX;
architecture auto of FSM_EX is
type STATE_TYPE is (S0,S1,S2,S3,S4,S5);
type CONTROL is (PUSH,POP,NOP);
-- pragma CLOCK ck
-- pragma CURRENT_STATE CURRENT_STATE
-- pragma NEXT_STATE NEXT_STATE
-- pragma RETURN_STATE RETURN_STATE
-- pragma CONTROL CTRL
-- pragma PUSH PUSH
-- pragma POP POP
-- pragma NOP NOP
-- pragma SCAN_TEST t_mode
-- pragma SCAN_IN s_in
-- pragma SCAN_OUT s_out
signal CURRENT_STATE, NEXT_STATE, RETURN_STATE : STATE_TYPE;
signal CTRL : CONTROL;
signal STACK_0, STACK_1 : STATE_TYPE ;
begin
PROCESS(CURRENT_STATE,I,reset)
begin
if(reset) then
NEXT_STATE <= S0 ;
o <= '0' ;
else
case CURRENT_STATE is
WHEN S0 =>
NEXT_STATE <= S1;
RETURN_STATE <= S5;
CTRL <= PUSH;
o <= '0';
WHEN S1 =>
if (I = '1') then
NEXT_STATE <= S2;
CTRL <= NOP;
else
NEXT_STATE <= S3;
CTRL <= NOP;
end if;
o <= '0';
WHEN S2 =>
NEXT_STATE <= S4;
CTRL <= NOP;
o <= '0';
WHEN S3 =>
NEXT_STATE <= S4;
CTRL <= NOP;
o <= '0';
WHEN S4 =>
NEXT_STATE <= STACK_0;
CTRL <= POP;
o <= '1';
WHEN S5 =>
if (I = '1') then
NEXT_STATE <= S1;
RETURN_STATE <= S0 ;
CTRL <= PUSH;
else
NEXT_STATE <= S5;
CTRL <= NOP;
end if ;
o <= '0';
WHEN others =>
assert ('1')
report "illegal state";
end case;
end if ;
end process;
process(ck)
begin
if(ck = '0' and not ck' stable) then
CURRENT_STATE <= NEXT_STATE;
case CTRL is
WHEN POP =>
STACK_0 <= STACK_1;
WHEN PUSH =>
STACK_1 <= STACK_0;
STACK_0 <= RETURN_STATE;
WHEN NOP =>
NULL;
end case;
end if;
end process;
end auto;
ate. ๐
๐ MULTI FSM EXAMPLE ๐
It is possible to describe in the same description two or more FSM communicating each others throw internal signals as shown below. It is also possible to incorporate concurrent statements using VBE(5) VHDL coding style. multi-FSM main character energy fr fr ๐
ENTITY multi_fsm is
PORT
( ck : in BIT;
data_in : in BIT;
reset : in BIT;
data_out : out BIT
);
END multi_fsm;
ARCHITECTURE FSM OF multi_fsm is
TYPE A_ETAT_TYPE IS (A_E0, A_E1);
SIGNAL A_NS, A_CS : A_ETAT_TYPE;
TYPE B_ETAT_TYPE IS (B_E0, B_E1);
SIGNAL B_NS, B_CS : B_ETAT_TYPE;
--PRAGMA CURRENT_STATE A_CS FSM_A
--PRAGMA NEXT_STATE A_NS FSM_A
--PRAGMA CLOCK ck FSM_A
--PRAGMA FIRST_STATE A_E0 FSM_A
--PRAGMA CURRENT_STATE B_CS FSM_B
--PRAGMA NEXT_STATE B_NS FSM_B
--PRAGMA CLOCK ck FSM_B
--PRAGMA FIRST_STATE B_E0 FSM_B
SIGNAL ACK, REQ, DATA_INT : BIT;
BEGIN
A_1 : PROCESS ( A_CS, ACK )
BEGIN
IF ( reset = '1' )
THEN A_NS <= A_E0;
DATA_OUT <= '0';
REQ <= '0';
ELSE
CASE A_CS is
WHEN A_E0 =>
IF ( ACK ='1') THEN A_NS <= A_E1;
ELSE A_NS <= A_E0;
END IF;
DATA_OUT <= '0';
REQ <= '1';
WHEN A_E1 =>
IF ( ACK ='1') THEN A_NS <= A_E1;
ELSE A_NS <= A_E0;
END IF;
DATA_OUT <= DATA_INT;
REQ <= '0';
END CASE;
END IF;
END PROCESS A_1;
A_2 : PROCESS( ck )
BEGIN
IF ( ck = '1' AND NOT ck'STABLE )
THEN A_CS <= A_NS;
END IF;
END PROCESS A_2;
-------
B_1 : PROCESS ( B_CS, ACK )
BEGIN
IF ( reset = '1' )
THEN B_NS <= B_E0;
DATA_INT <= '0';
ACK <= '0';
ELSE
CASE B_CS is
WHEN B_E0 =>
IF ( REQ ='1') THEN B_NS <= B_E1;
ELSE B_NS <= B_E0;
END IF;
DATA_INT <= '0';
ACK <= '0';
WHEN B_E1 =>
IF ( REQ ='1') THEN B_NS <= B_E1;
ELSE B_NS <= B_E0;
END IF;
DATA_INT <= DATA_IN;
ACK <= '1';
END CASE;
END IF;
END PROCESS B_1;
B_2 : PROCESS( ck )
BEGIN
IF ( ck = '1' AND NOT ck'STABLE )
THEN B_CS <= B_NS;
END IF;
END PROCESS B_2;
END FSM;
two FSMs, one file, communicating through internal signals. the way that they just talk to each other ๐ฆ iconic.
๐ SEE ALSO ๐
๐ BUG REPORT ๐
This tool is under development at the ASIM department of the LIP6 laboratory. We need your feedback to improve documentation and tools. so like, if something's broken, pls tell them, they're literally asking ๐
that's the whole page bestie ๐ every pragma, every process, every '0' and every WHEN others => right where it belongs. and for the record, this came to you from ASIM/LIP6, dated October 1, 1997, living in section FSM(5) of the manual โ yeah, it's vintage, and yeah, it still slays. ๐
โจ๐
๐ฆ where this page comes from
- fedora 43: alliance-libs 5.1.1-35.20160506gitd8c05cd.fc42 ยท GPL-2.0-only
- fedora 43: alliance-libs 5.1.1-35.20160506gitd8c05cd.fc42 ยท GPL-2.0-only
- fedora 44: alliance-libs 5.1.1-35.20160506gitd8c05cd.fc42 ยท GPL-2.0-only
- fedora 44: alliance-libs 5.1.1-35.20160506gitd8c05cd.fc42 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms