OpenCores
URL https://opencores.org/ocsvn/idea/idea/trunk

Subversion Repositories idea

[/] [idea/] [trunk/] [fsm/] [control_dataout.fsm] - Rev 11

Go to most recent revision | Compare with Previous | Blame | View Log

-- File Name   : control_dataout.fsm                            -- 
-- Description : The control of data-out blok                   --
-- Purpose     : To be used by SYF                              --
-- Date        : Aug 30, 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 control_dataout IS
PORT ( clk,rst,cp_ready,emp_bufout  : IN  BIT;
       en_bufout,req_cp,cp_sended   : OUT BIT;
       n_block                      : OUT BIT;
       vdd, vss                     : IN BIT
      );
END control_dataout;

ARCHITECTURE fsm OF control_dataout IS

TYPE STATE_TYPE IS (S0, S1, S2, S3, S4);

-- pragma CLOCK clk
-- pragma CURRENT_STATE CURRENT_STATE
-- pragma NEXT_STATE NEXT_STATE

SIGNAL CURRENT_STATE, NEXT_STATE: STATE_TYPE;

BEGIN
  PROCESS ( CURRENT_STATE, rst)
    BEGIN
      IF ( rst = '1' ) THEN
          NEXT_STATE <= S0;
          req_cp <= '1';    
          en_bufout <= '0';
          cp_sended <= '0';
          n_block  <= '0';
      ELSE
          CASE CURRENT_STATE IS
             WHEN S0 =>
                if(cp_ready = '1') then
                   req_cp   <= '0';
                   en_bufout <= '1';
                   cp_sended <= '0';
                   n_block  <= '0';
                   NEXT_STATE <= S1;
                 else
                   req_cp   <= '1';
                   en_bufout <= '0';
                   cp_sended <= '0';
                   n_block  <= '0';     
                   NEXT_STATE <= S0;
                 end if;                             
             WHEN S1 =>                    
                   req_cp   <= '0';
                   en_bufout <= '0';
                   cp_sended <= '1';
                   n_block  <= '1';
                   NEXT_STATE <= S2;                         
             WHEN S2 => 
                if(emp_bufout = '1') then
                   req_cp   <= '0';
                   en_bufout <= '1';     
                   cp_sended <= '0';
                   n_block  <= '1';                                           
                   NEXT_STATE <= S3;
                else
                   req_cp   <= '0';
                   en_bufout <= '0';     
                   cp_sended <= '1';
                   n_block  <= '1';                                           
                   NEXT_STATE <= S2;
                end if;
             WHEN S3 =>                    
                   req_cp   <= '0';
                   en_bufout <= '0';
                   cp_sended <= '1';
                   n_block  <= '0';
                   NEXT_STATE <= S4;                   
             WHEN S4 => 
                if(emp_bufout = '1') then
                   req_cp   <= '1';
                   en_bufout <= '0';     
                   cp_sended <= '0';
                   n_block  <= '0';                                           
                   NEXT_STATE <= S0;
                else
                   req_cp   <= '0';
                   en_bufout <= '0';     
                   cp_sended <= '1';
                   n_block  <= '0';                                           
                   NEXT_STATE <= S4;
                end if;
             WHEN OTHERS =>
                ASSERT ( '1' )
                REPORT "Illegal State";

          END CASE;
      END IF;
END PROCESS;

PROCESS (clk)
  BEGIN
    IF ((clk AND NOT clk'STABLE) ='1') THEN
         CURRENT_STATE <= NEXT_STATE;
    END IF;
END PROCESS;

END fsm;

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.