URL
https://opencores.org/ocsvn/idea/idea/trunk
Subversion Repositories idea
[/] [idea/] [trunk/] [fsm/] [heart_ctrl.fsm] - Rev 11
Go to most recent revision | Compare with Previous | Blame | View Log
-- File Name : heart_ctrl.fsm --
-- Description : The heart control of idea processor --
-- Purpose : To be used by SYF --
-- Date : Aug 23, 2001 --
-- Version : 1.1 --
-- Author : Martadinata A. --
-- Address : VLSI RG, Dept. of Electrical Engineering ITB, --
-- Bandung, Indonesia --
-- E-mail : marta@ic.vlsi.itb.ac.id --
entity heart_ctrl is
port(
ck,reset,start,key_ready : in bit;
round : out bit_vector(2 downto 0);
en1,en2,en3,en4,en5,en6,en7,en_out : out bit;
en_key_out,sel_in : out bit;
finish : out bit;
vdd, vss : in bit
);
end heart_ctrl;
architecture fsm of heart_ctrl is
type STATE_TYPE is (S1,S2,S3,S4,S5,S6,S7,S8,S9,S10,S11,S12,S13,S14,
S15,S16,S17,S18,S19,S20,S21,S22,S23,S24,S25,S26,S27,S28,S29,S30,S31,
S32,S33,S34,S35,S36,S37,S38,S39,S40,S41,S42,S43,S44,S45,S46,
S47,S48,S49,S50,S51,S52,S53,S54,S55,S56,S57,S58,S59,S60,S61,S62,S63,S64,
S65,S66,S67);
-- pragma CLOCK ck
-- pragma CURRENT_STATE CURRENT_STATE
-- pragma NEXT_STATE NEXT_STATE
signal CURRENT_STATE,NEXT_STATE: STATE_TYPE;
begin
process (CURRENT_STATE,start,key_ready,reset)
begin
if (reset = '1') then
NEXT_STATE <= S1;
else
case CURRENT_STATE is
-- round 1 --
when S1 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
round <= "000";
sel_in <= '0';
finish <= '0';
if((start and key_ready) = '1') then
en_key_out <= '1';
NEXT_STATE <= S2;
else
en_key_out <= '0';
NEXT_STATE <= S1;
end if;
when S2 =>
en1 <= '1'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "000";
en_key_out <= '0';
sel_in <= '0';
NEXT_STATE <= S3;
when S3 =>
en1 <= '0'; en2 <= '1'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "000";
en_key_out <= '0';
sel_in <= '0';
NEXT_STATE <= S4;
when S4 =>
en1 <= '0'; en2 <= '0'; en3 <= '1'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "000";
en_key_out <= '0';
sel_in <= '0';
NEXT_STATE <= S5;
when S5 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '1';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "000";
en_key_out <= '0';
sel_in <= '0';
NEXT_STATE <= S6;
when S6 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '1'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "000";
en_key_out <= '0';
sel_in <= '0';
NEXT_STATE <= S7;
when S7 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '1'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "000";
en_key_out <= '0';
sel_in <= '0';
NEXT_STATE <= S8;
when S8 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '1'; en_out <= '0';
finish <= '0';
round <= "000";
en_key_out <= '0';
sel_in <= '0';
NEXT_STATE <= S9;
-- round 2 --
when S9 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "001";
en_key_out <= '1';
sel_in <= '1';
NEXT_STATE <= S10;
when S10 =>
en1 <= '1'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "001";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S11;
when S11 =>
en1 <= '0'; en2 <= '1'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "001";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S12;
when S12 =>
en1 <= '0'; en2 <= '0'; en3 <= '1'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "001";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S13;
when S13 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '1';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "001";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S14;
when S14 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '1'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "001";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S15;
when S15 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '1'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "001";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S16;
when S16 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '1'; en_out <= '0';
finish <= '0';
round <= "001";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S17;
-- round 3 --
when S17 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "010";
en_key_out <= '1';
sel_in <= '1';
NEXT_STATE <= S18;
when S18 =>
en1 <= '1'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "010";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S19;
when S19 =>
en1 <= '0'; en2 <= '1'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "010";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S20;
when S20 =>
en1 <= '0'; en2 <= '0'; en3 <= '1'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "010";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S21;
when S21 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '1';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "010";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S22;
when S22 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '1'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "010";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S23;
when S23 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '1'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "010";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S24;
when S24 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '1'; en_out <= '0';
finish <= '0';
round <= "010";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S25;
-- round 4 --
when S25 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "011";
en_key_out <= '1';
sel_in <= '1';
NEXT_STATE <= S26;
when S26 =>
en1 <= '1'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "011";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S27;
when S27 =>
en1 <= '0'; en2 <= '1'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "011";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S28;
when S28 =>
en1 <= '0'; en2 <= '0'; en3 <= '1'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "011";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S29;
when S29 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '1';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "011";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S30;
when S30 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '1'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "011";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S31;
when S31 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '1'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "011";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S32;
when S32 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '1'; en_out <= '0';
finish <= '0';
round <= "011";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S33;
-- round 5 --
when S33 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "100";
en_key_out <= '1';
sel_in <= '1';
NEXT_STATE <= S34;
when S34 =>
en1 <= '1'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "100";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S35;
when S35 =>
en1 <= '0'; en2 <= '1'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "100";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S36;
when S36 =>
en1 <= '0'; en2 <= '0'; en3 <= '1'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "100";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S37;
when S37 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '1';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "100";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S38;
when S38 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '1'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "100";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S39;
when S39 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '1'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "100";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S40;
when S40 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '1'; en_out <= '0';
finish <= '0';
round <= "100";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S41;
-- round 6 --
when S41 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "101";
en_key_out <= '1';
sel_in <= '1';
NEXT_STATE <= S42;
when S42 =>
en1 <= '1'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "101";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S43;
when S43 =>
en1 <= '0'; en2 <= '1'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "101";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S44;
when S44 =>
en1 <= '0'; en2 <= '0'; en3 <= '1'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "101";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S45;
when S45 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '1';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "101";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S46;
when S46 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '1'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "101";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S47;
when S47 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '1'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "101";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S48;
when S48 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '1'; en_out <= '0';
finish <= '0';
round <= "101";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S49;
-- round 7 --
when S49 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "110";
en_key_out <= '1';
sel_in <= '1';
NEXT_STATE <= S50;
when S50 =>
en1 <= '1'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "110";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S51;
when S51 =>
en1 <= '0'; en2 <= '1'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "110";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S52;
when S52 =>
en1 <= '0'; en2 <= '0'; en3 <= '1'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "110";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S53;
when S53 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '1';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "110";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S54;
when S54 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '1'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "110";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S55;
when S55 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '1'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "110";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S56;
when S56 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '1'; en_out <= '0';
finish <= '0';
round <= "110";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S57;
-- round 8 --
when S57 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "111";
en_key_out <= '1';
sel_in <= '1';
NEXT_STATE <= S58;
when S58 =>
en1 <= '1'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "111";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S59;
when S59 =>
en1 <= '0'; en2 <= '1'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "111";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S60;
when S60 =>
en1 <= '0'; en2 <= '0'; en3 <= '1'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "111";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S61;
when S61 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '1';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "111";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S62;
when S62 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '1'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "111";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S63;
when S63 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '1'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "111";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S64;
when S64 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '1'; en_out <= '0';
finish <= '0';
round <= "111";
en_key_out <= '0';
sel_in <= '1';
NEXT_STATE <= S65;
-- output transformation --
when S65 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '0';
round <= "111";
en_key_out <= '1';
sel_in <= '0';
NEXT_STATE <= S66;
when S66 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '1';
finish <= '0';
round <= "111";
en_key_out <= '0';
sel_in <= '0';
NEXT_STATE <= S67;
when S67 =>
en1 <= '0'; en2 <= '0'; en3 <= '0'; en4 <= '0';
en5 <= '0'; en6 <= '0'; en7 <= '0'; en_out <= '0';
finish <= '1';
round <= "111";
en_key_out <= '0';
sel_in <= '0';
NEXT_STATE <= S1;
when others =>
assert('1')
report "Illegal state";
end case;
end if;
end process;
process (ck)
begin
if ((ck AND NOT ck'STABLE) = '1') then
CURRENT_STATE <= NEXT_STATE;
end if;
end process;
end fsm;
Go to most recent revision | Compare with Previous | Blame | View Log