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

Subversion Repositories mkjpeg

[/] [mkjpeg/] [trunk/] [design/] [common/] [SingleSM.vhd] - Blame information for rev 67

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

Line No. Rev Author Line
1 25 mikel262
-------------------------------------------------------------------------------
2
-- File Name :  SingleSM.vhd
3
--
4
-- Project   : 
5
--
6
-- Module    :
7
--
8
-- Content   : 
9
--
10
-- Description : 
11
--
12
-- Spec.     : 
13
--
14
-- Author    : Michal Krepa
15
-------------------------------------------------------------------------------
16
-- History :
17
-- 20080301: (MK): Initial Creation.
18
-------------------------------------------------------------------------------
19
 
20
library ieee;
21
  use ieee.std_logic_1164.all;
22
 
23
entity SingleSM is
24
  port
25
  (
26
        CLK                : in  std_logic;
27
        RST                : in  std_logic;
28
        -- from/to SM(m)
29
        start_i            : in  std_logic;
30
        idle_o             : out std_logic;
31
        -- from/to SM(m+1)
32
        idle_i             : in  std_logic;
33
        start_o            : out std_logic;
34
        -- from/to processing block
35
        pb_rdy_i           : in  std_logic;
36
        pb_start_o         : out std_logic;
37
        -- state debug
38
        fsm_o              : out std_logic_vector(1 downto 0)
39
    );
40
end entity SingleSM;
41
 
42
-------------------------------------------------------------------------------
43
-------------------------------------------------------------------------------
44
----------------------------------- ARCHITECTURE ------------------------------
45
-------------------------------------------------------------------------------
46
-------------------------------------------------------------------------------
47
architecture SingleSM_rtl of SingleSM is
48
 
49
 
50
-------------------------------------------------------------------------------
51
-- Architecture: Signal definition.
52
-------------------------------------------------------------------------------
53
  type T_STATE is (IDLE, WAIT_FOR_BLK_RDY, WAIT_FOR_BLK_IDLE);
54
 
55
  signal state : T_STATE;
56
 
57
-------------------------------------------------------------------------------
58
-- Architecture: begin
59
-------------------------------------------------------------------------------
60
begin
61
 
62
  fsm_o <= "00" when state = IDLE else
63
           "01" when state = WAIT_FOR_BLK_RDY else
64
           "10" when state = WAIT_FOR_BLK_IDLE else
65
           "11";
66
 
67
  ------------------------------------------------------------------------------
68
  -- FSM
69
  ------------------------------------------------------------------------------
70
  p_fsm : process(CLK, RST)
71
  begin
72
    if RST = '1' then
73
      idle_o     <= '0';
74
      start_o    <= '0';
75
      pb_start_o <= '0';
76
      state      <= IDLE;
77
    elsif CLK'event and CLK = '1' then
78
      idle_o     <= '0';
79
      start_o    <= '0';
80
      pb_start_o <= '0';
81
 
82
      case state is
83
        when IDLE =>
84
          idle_o <= '1';
85
          -- this fsm is started
86
          if start_i = '1' then
87
            state      <= WAIT_FOR_BLK_RDY;
88
            -- start processing block associated with this FSM
89
            pb_start_o <= '1';
90
            idle_o     <= '0';
91
          end if;
92
 
93
        when WAIT_FOR_BLK_RDY =>
94
          -- wait until processing block completes
95
          if pb_rdy_i = '1' then
96
            -- wait until next FSM is idle before starting it
97
            if idle_i = '1' then
98
              state   <= IDLE;
99
              start_o <= '1';
100
            else
101
              state <= WAIT_FOR_BLK_IDLE;
102
            end if;
103
          end if;
104
 
105
        when WAIT_FOR_BLK_IDLE =>
106
          if idle_i = '1' then
107
            state   <= IDLE;
108
            start_o <= '1';
109
          end if;
110
 
111
        when others =>
112
          idle_o     <= '0';
113
          start_o    <= '0';
114
          pb_start_o <= '0';
115
          state      <= IDLE;
116
 
117
      end case;
118
 
119
    end if;
120
  end process;
121
 
122
end architecture SingleSM_rtl;
123
-------------------------------------------------------------------------------
124
-- Architecture: end
125
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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