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

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [VHDL/] [pipeline/] [pipeline_controller-mealy.vhdl] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 lcdsgmtr
-- Copyright 2015, Jürgen Defurne
2
--
3
-- This file is part of the Experimental Unstable CPU System.
4
--
5
-- The Experimental Unstable CPU System Is free software: you can redistribute
6
-- it and/or modify it under the terms of the GNU Lesser General Public License
7
-- as published by the Free Software Foundation, either version 3 of the
8
-- License, or (at your option) any later version.
9
--
10
-- The Experimental Unstable CPU System is distributed in the hope that it will
11
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
13
-- General Public License for more details.
14
--
15
-- You should have received a copy of the GNU Lesser General Public License
16
-- along with Experimental Unstable CPU System. If not, see
17
-- http://www.gnu.org/licenses/lgpl.txt.
18
 
19
 
20
ARCHITECTURE mealy OF pipeline_controller IS
21
 
22
  TYPE pl_state IS (S0, S1, S2, S3);
23
 
24
  SIGNAL next_state   : pl_state := S0;
25
  SIGNAL pl_state_reg : pl_state := S0;
26
 
27
BEGIN  -- ARCHITECTURE rofsm
28
 
29
-- purpose: compute next state from current state
30
  -- type   : combinational
31
  -- inputs : pl_state_reg
32
  -- outputs: next_state
33
  next_state_logic : PROCESS (pl_state_reg) IS
34
  BEGIN  -- PROCESS next_state_logic
35
    CASE pl_state_reg IS
36
      WHEN S0 =>
37
        next_state <= S1;
38
      WHEN S1 =>
39
        next_state <= S2;
40
      WHEN S2 =>
41
        next_state <= S3;
42
      WHEN S3 =>
43
        next_state <= S3;
44
    END CASE;
45
  END PROCESS next_state_logic;
46
 
47
  -- purpose: State register
48
  -- type   : sequential
49
  -- inputs : CLK, RST, next_state
50
  -- outputs: pl_state_reg
51
  state_register : PROCESS (CLK, RST) IS
52
  BEGIN  -- PROCESS state_register
53
    IF rising_edge(CLK) THEN            -- rising clock edge
54
      IF RST = '1' THEN
55
        pl_state_reg <= S0;
56
      ELSE
57
        pl_state_reg <= next_state;
58
      END IF;
59
    END IF;
60
  END PROCESS state_register;
61
 
62
  -- purpose: compute outputs based on state
63
  -- type   : combinational
64
  -- inputs : pl_state_reg
65
  -- outputs: EN(0),EN(1),EN(2)
66
  output_logic : PROCESS (pl_state_reg, RST, PULL) IS
67
  BEGIN  -- PROCESS output_logic
68
    CASE pl_state_reg IS
69
      WHEN S0 =>
70
        IF RST = '1' THEN
71
          SUM   <= '0';
72
          EN(0) <= '0';
73
          EN(1) <= '0';
74
          EN(2) <= '0';
75
          FULL  <= '0';
76
        ELSE
77
          SUM   <= '0';
78
          EN(0) <= '1';
79
          EN(1) <= '0';
80
          EN(2) <= '0';
81
          FULL  <= '0';
82
        END IF;
83
      WHEN S1 =>
84
        SUM   <= '1';
85
        EN(0) <= '1';
86
        EN(1) <= '1';
87
        EN(2) <= '0';
88
        FULL  <= '0';
89
      WHEN S2 =>
90
        SUM   <= '1';
91
        EN(0) <= '1';
92
        EN(1) <= '1';
93
        EN(2) <= '1';
94
        FULL  <= '0';
95
      WHEN S3 =>
96
        IF PULL = '1' THEN
97
          SUM   <= '1';
98
          EN(0) <= '1';
99
          EN(1) <= '1';
100
          EN(2) <= '1';
101
          FULL  <= '1';
102
        ELSE
103
          SUM   <= '0';
104
          EN(0) <= '0';
105
          EN(1) <= '0';
106
          EN(2) <= '0';
107
          FULL  <= '1';
108
        END IF;
109
    END CASE;
110
  END PROCESS output_logic;
111
 
112
END ARCHITECTURE mealy;

powered by: WebSVN 2.1.0

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