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

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [src/] [system/] [uctrl-init.vhdl] - Blame information for rev 34

Go to most recent revision | 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 uctrl IS
21
 
22
  TYPE uCtrl_state IS (
23
    S_0,
24
    S_1,
25
    S_2,
26
    S_3,
27
    S_4,
28
    S_5,
29
    S_6
30
    );
31
 
32
  SIGNAL NEXT_STATE : uCtrl_state;
33
  SIGNAL CURR_STATE : uCtrl_state;
34
 
35
BEGIN  -- ARCHITECTURE Mealy
36
 
37
-- purpose: Next state functionality
38
-- type   : combinational
39
-- inputs : IR_IN,ZERO,INT,RST,CURR_STATE
40
-- outputs: 
41
  NEXT_ST1 : PROCESS (CURR_STATE, IR_IN, INT, RST)
42
  BEGIN  -- PROCESS uCTRL
43
 
44
    IF RST = '1' THEN
45
      NEXT_STATE <= S_0;
46
    ELSE
47
 
48
      CASE CURR_STATE IS
49
        WHEN S_0 =>
50
          NEXT_STATE <= S_1;
51
        WHEN S_1 =>
52
          NEXT_STATE <= S_2;
53
        WHEN S_2 =>
54
          NEXT_STATE <= S_3;
55
        WHEN S_3 =>
56
          NEXT_STATE <= S_4;
57
        WHEN S_4 =>
58
          NEXT_STATE <= S_5;
59
        WHEN S_5 =>
60
          NEXT_STATE <= S_6;
61
        WHEN S_6 =>
62
          NEXT_STATE <= S_6;
63
 
64
      END CASE;
65
    END IF;
66
  END PROCESS NEXT_ST1;
67
 
68
  -- State register logic
69
  STATE_REG1 : PROCESS (CLK, RST)
70
  BEGIN
71
    IF rising_edge(CLK) THEN
72
      IF RST = '1' THEN
73
        CURR_STATE <= S_0;
74
      ELSE
75
        CURR_STATE <= NEXT_STATE;
76
      END IF;
77
    END IF;
78
  END PROCESS STATE_REG1;
79
 
80
  -- Mealy output function logic
81
  OUT1 : PROCESS (CURR_STATE, RST, IR_IN, INT)
82
  BEGIN
83
    -- Make sure that all control signals are initialised
84
    PC_SRC   <= "011";
85
    LD_PC    <= '0';
86
    LD_IR    <= '0';
87
    LD_DP    <= '0';
88
    REG_SRC  <= "000";
89
    RFA_A    <= "0000";
90
    RFA_B    <= "0000";
91
    REG_WR   <= '0';
92
    LD_REG_A <= '0';
93
    LD_REG_B <= '0';
94
    LD_MAR   <= '0';
95
    LD_MDR   <= '0';
96
    MEM_WR   <= '0';
97
    ALU_OP   <= "0000";
98
 
99
    CASE CURR_STATE IS
100
      WHEN S_0 =>
101
        IF RST = '0' THEN
102
          PC_SRC <= "100";
103
          LD_PC  <= '1';
104
          LD_IR  <= '0';
105
        END IF;
106
      WHEN S_1 =>
107
        PC_SRC <= "001";
108
        LD_PC  <= '1';
109
        LD_IR  <= '1';
110
      WHEN S_2 =>
111
        LD_IR  <= '0';
112
      WHEN S_3 =>
113
        NULL;
114
      WHEN S_4 =>
115
        PC_SRC <= "001";
116
        LD_PC  <= '1';
117
        LD_IR  <= '1';
118
      WHEN S_5 =>
119
        NULL;
120
      WHEN S_6 =>
121
        NULL;
122
    END CASE;
123
 
124
  END PROCESS OUT1;
125
 
126
END ARCHITECTURE Mealy;

powered by: WebSVN 2.1.0

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