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

Subversion Repositories tg68

[/] [tg68/] [trunk/] [VHDL/] [TG68.vhd] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 tobiflex
------------------------------------------------------------------------------
2
------------------------------------------------------------------------------
3
--                                                                          --
4
-- This is the TOP-Level for TG68_fast to generate 68K Bus signals          --
5
--                                                                          --
6
-- Copyright (c) 2007 Tobias Gubener <tobiflex@opencores.org>               -- 
7
--                                                                          --
8
-- This source file is free software: you can redistribute it and/or modify --
9
-- it under the terms of the GNU Lesser General Public License as published --
10
-- by the Free Software Foundation, either version 3 of the License, or     --
11
-- (at your option) any later version.                                      --
12
--                                                                          --
13
-- This source file is distributed in the hope that it will be useful,      --
14
-- but WITHOUT ANY WARRANTY; without even the implied warranty of           --
15
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            --
16
-- GNU General Public License for more details.                             --
17
--                                                                          --
18
-- You should have received a copy of the GNU General Public License        --
19
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.    --
20
--                                                                          --
21
------------------------------------------------------------------------------
22
------------------------------------------------------------------------------
23
--
24
-- Revision 1.0 2007/11/05
25
-- Clean up code and first release
26
--
27
-- known bugs/todo:
28
-- Add CHK INSTRUCTION
29
-- Add MOVEP INSTRUCTION
30
-- full decode ILLEGAL INSTRUCTIONS
31
-- Add FDC Output
32
-- add odd Address test
33
-- add TRACE
34
-- Movem with regmask==x0000
35
 
36
 
37
 
38
library ieee;
39
use ieee.std_logic_1164.all;
40
use ieee.std_logic_unsigned.all;
41
 
42
entity TG68 is
43
   port(
44
                clk           : in std_logic;
45
                reset         : in std_logic;
46
        clkena_in     : in std_logic:='1';
47
        data_in       : in std_logic_vector(15 downto 0);
48
        IPL           : in std_logic_vector(2 downto 0):="111";
49
        dtack         : in std_logic;
50
        addr          : out std_logic_vector(31 downto 0);
51
        data_out      : out std_logic_vector(15 downto 0);
52
        as            : out std_logic;
53
        uds           : out std_logic;
54
        lds           : out std_logic;
55
        rw            : out std_logic
56
        );
57
end TG68;
58
 
59
ARCHITECTURE logic OF TG68 IS
60
 
61
        COMPONENT TG68_fast
62
    PORT (
63
        clk           : in std_logic;
64
        reset         : in std_logic;
65
        clkena_in     : in std_logic;
66
        data_in       : in std_logic_vector(15 downto 0);
67
                IPL                       : in std_logic_vector(2 downto 0);
68
        test_IPL      : in std_logic;
69
        address       : out std_logic_vector(31 downto 0);
70
        data_write    : out std_logic_vector(15 downto 0);
71
        state_out     : out std_logic_vector(1 downto 0);
72
        decodeOPC     : buffer std_logic;
73
                wr                        : out std_logic;
74
                UDS, LDS          : out std_logic
75
        );
76
        END COMPONENT;
77
 
78
 
79
   SIGNAL as_s        : std_logic;
80
   SIGNAL as_e        : std_logic;
81
   SIGNAL uds_s       : std_logic;
82
   SIGNAL uds_e       : std_logic;
83
   SIGNAL lds_s       : std_logic;
84
   SIGNAL lds_e       : std_logic;
85
   SIGNAL rw_s        : std_logic;
86
   SIGNAL rw_e        : std_logic;
87
   SIGNAL waitm       : std_logic;
88
   SIGNAL clkena_e    : std_logic;
89
   SIGNAL S_state     : std_logic_vector(1 downto 0);
90
   SIGNAL decode          : std_logic;
91
   SIGNAL wr          : std_logic;
92
   SIGNAL uds_in          : std_logic;
93
   SIGNAL lds_in          : std_logic;
94
   SIGNAL state       : std_logic_vector(1 downto 0);
95
   SIGNAL clkena          : std_logic;
96
 
97
 
98
BEGIN
99
 
100
TG68_fast_inst: TG68_fast
101
        PORT MAP (
102
                clk => not clk,                 -- : in std_logic;
103
        reset => reset,                 -- : in std_logic;
104
        clkena_in => clkena,    -- : in std_logic;
105
        data_in => data_in,     -- : in std_logic_vector(15 downto 0);
106
                IPL => IPL,                     -- : in std_logic_vector(2 downto 0);
107
        test_IPL => '0',                 -- : in std_logic;
108
        address => addr,                -- : out std_logic_vector(31 downto 0);
109
        data_write => data_out, -- : out std_logic_vector(15 downto 0);
110
        state_out => state,     -- : out std_logic_vector(1 downto 0);
111
        decodeOPC => decode,    -- : buffer std_logic;
112
                wr => wr,                               -- : out std_logic;
113
                UDS => uds_in,                  -- : out std_logic;
114
                LDS => lds_in                   -- : out std_logic;
115
        );
116
 
117
--      clkena <= '1' WHEN clkena_in='1' AND ((clkena_e OR decode)='1')
118
--                                ELSE '0';
119
 
120
 
121
        PROCESS (clk)
122
        BEGIN
123
                IF rising_edge(clk) THEN
124
--                      IF clkena_in='1' AND ((clkena_e OR decode)='1') THEN
125
                        IF clkena_in='1' AND (clkena_e='1' OR state="01") THEN
126
                                clkena <= '1';
127
                        ELSE
128
                                clkena <= '0';
129
                        END IF;
130
                END IF;
131
        END PROCESS;
132
 
133
PROCESS (clk, reset, state, as_s, as_e, rw_s, rw_e, uds_s, uds_e, lds_s, lds_e)
134
        BEGIN
135
                IF state="01" THEN
136
                        as <= '1';
137
                        rw <= '1';
138
                        uds <= '1';
139
                        lds <= '1';
140
                ELSE
141
                        as <= as_s AND as_e;
142
                        rw <= rw_s AND rw_e;
143
                        uds <= uds_s AND uds_e;
144
                        lds <= lds_s AND lds_e;
145
                END IF;
146
                IF reset='0' THEN
147
                        S_state <= "11";
148
                        as_s <= '1';
149
                        rw_s <= '1';
150
                        uds_s <= '1';
151
                        lds_s <= '1';
152
                ELSIF rising_edge(clk) THEN
153
                IF clkena_in='1' THEN
154
                                as_s <= '1';
155
                                rw_s <= '1';
156
                                uds_s <= '1';
157
                                lds_s <= '1';
158
                                                                 IF state/="01" OR decode='1' THEN
159
                                CASE S_state IS
160
                                        WHEN "00" => as_s <= '0';
161
                                                                 rw_s <= wr;
162
                                                                 IF wr='1' THEN
163
                                                                         uds_s <= uds_in;
164
                                                                         lds_s <= lds_in;
165
                                                                 END IF;
166
                                                                        S_state <= "01";
167
                                        WHEN "01" => as_s <= '0';
168
                                                                 rw_s <= wr;
169
                                                                 uds_s <= uds_in;
170
                                                                 lds_s <= lds_in;
171
                                                                 S_state <= "10";
172
                                        WHEN "10" =>
173
                                                                 rw_s <= wr;
174
                                                                 IF waitm='0' THEN
175
                                                                        S_state <= "11";
176
                                                                 END IF;
177
                                        WHEN "11" =>
178
                                                                 S_state <= "00";
179
                                END CASE;
180
                                                                 END IF;
181
                        END IF;
182
                END IF;
183
                IF reset='0' THEN
184
                        as_e <= '1';
185
                        rw_e <= '1';
186
                        uds_e <= '1';
187
                        lds_e <= '1';
188
                        clkena_e <= '0';
189
                ELSIF falling_edge(clk) THEN
190
                IF clkena_in='1' THEN
191
                                as_e <= '1';
192
                                rw_e <= '1';
193
                                uds_e <= '1';
194
                                lds_e <= '1';
195
                                clkena_e <= '0';
196
                                CASE S_state IS
197
                                        WHEN "00" =>
198
                                        WHEN "01" =>
199
                                        WHEN "10" => as_e <= '0';
200
                                                                 uds_e <= uds_in;
201
                                                                 lds_e <= lds_in;
202
                                                                 IF state="01" THEN
203
                                                                         clkena_e <= '1';
204
                                                                         waitm <= '0';
205
                                                                 ELSE
206
                                                                         clkena_e <= NOT dtack;
207
                                                                         waitm <= dtack;
208
                                                                 END IF;
209
                                        WHEN "11" =>
210
                                END CASE;
211
                        END IF;
212
                END IF;
213
        END PROCESS;
214
END;

powered by: WebSVN 2.1.0

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