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

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [VHDL/] [pipeline/] [memory_controller-arch.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 memory_controller IS
21
 
22
  TYPE state IS (S0, S1, S2);
23
 
24
  SIGNAL next_state    : state;
25
  SIGNAL current_state : state;
26
 
27
BEGIN  -- ARCHITECTURE mealy
28
 
29
  -- Next state logic
30
  PROCESS (current_state)
31
  BEGIN
32
    CASE current_state IS
33
      WHEN S0 =>
34
        next_state <= S1;
35
      WHEN S1 =>
36
        next_state <= S2;
37
      WHEN S2 =>
38
        next_state <= S2;
39
    END CASE;
40
  END PROCESS;
41
 
42
  -- State register logic
43
  PROCESS (CLK, RST)
44
  BEGIN
45
    IF rising_edge(CLK) THEN
46
      IF RST = '1' THEN
47
        current_state <= S0;
48
      ELSE
49
        current_state <= next_state;
50
      END IF;
51
    END IF;
52
  END PROCESS;
53
 
54
  -- Output signal logic
55
  PROCESS (current_state, RST, PULL)
56
  BEGIN
57
    CASE current_state IS
58
      WHEN S0 =>
59
        IF RST = '1' THEN
60
          SEL  <= "00";
61
          EN0  <= '0';
62
          EN1  <= '0';
63
          FULL <= '0';
64
        ELSE
65
          SEL  <= "00";
66
          EN0  <= '1';
67
          EN1  <= '0';
68
          FULL <= '0';
69
        END IF;
70
      WHEN S1 =>
71
        SEL  <= "10";
72
        EN0  <= '1';
73
        EN1  <= '1';
74
        FULL <= '0';
75
      WHEN S2 =>
76
        IF PULL = '0' THEN
77
          SEL  <= "01";
78
          EN0  <= '0';
79
          EN1  <= '0';
80
          FULL <= '1';
81
        ELSE
82
          SEL  <= "10";
83
          EN0  <= '1';
84
          EN1  <= '1';
85
          FULL <= '1';
86
        END IF;
87
    END CASE;
88
  END PROCESS;
89
 
90
END ARCHITECTURE mealy;

powered by: WebSVN 2.1.0

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