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

Subversion Repositories the_wizardry_project

[/] [the_wizardry_project/] [trunk/] [Wizardry/] [VHDL/] [Wizardry Top Level/] [Address Generation/] [JOP/] [extension.vhd] - Blame information for rev 22

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 22 mcwaccent
--
2
--
3
--  This file is a part of JOP, the Java Optimized Processor
4
--
5
--  Copyright (C) 2001-2008, Martin Schoeberl (martin@jopdesign.com)
6
--
7
--  This program is free software: you can redistribute it and/or modify
8
--  it under the terms of the GNU General Public License as published by
9
--  the Free Software Foundation, either version 3 of the License, or
10
--  (at your option) any later version.
11
--
12
--  This program is distributed in the hope that it will be useful,
13
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
--  GNU General Public License for more details.
16
--
17
--  You should have received a copy of the GNU General Public License
18
--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
--
20
 
21
 
22
--
23
--      extension.vhd
24
--
25
--      contains interface to memory, multiplier and IO
26
--      MUX for din from stack
27
--      
28
--      resources on Cyclone
29
--      
30
--               55 LCs (+xxx for mul)
31
--
32
--              ext_addr and wr are one cycle earlier than data
33
--              dout is read one cycle after rd
34
--
35
--      address mapping see jop_tpyes.vhd
36
--
37
--
38
--      2004-09-11      first version
39
--      2005-04-05      Reserve negative addresses for wishbone interface
40
--      2005-04-07      generate bsy from delayed wr or'ed with mem_out.bsy
41
--      2005-05-30      added wishbone interface
42
--      2005-11-28      Substitute WB interface by the SimpCon IO interface ;-)
43
--                              All IO devices are now memory mapped
44
--      2007-04-13      Changed memory connection to records
45
--                              New array instructions
46
--      2007-12-22      Correction of data MUX bug for array read access
47
--      2008-02-20      Removed memory - I/O muxing
48
--
49
 
50
 
51
library ieee ;
52
use ieee.std_logic_1164.all ;
53
use ieee.numeric_std.all ;
54
 
55
use work.jop_types.all;
56
 
57
entity extension is
58
 
59
port (
60
        clk, reset      : in std_logic;
61
 
62
-- core interface
63
 
64
        ain             : in std_logic_vector(31 downto 0);              -- TOS
65
        bin             : in std_logic_vector(31 downto 0);              -- NOS
66
        ext_addr        : in std_logic_vector(exta_width-1 downto 0);
67
        rd, wr          : in std_logic;
68
        bsy             : out std_logic;
69
        dout            : out std_logic_vector(31 downto 0);     -- to stack
70
 
71
-- memory interface
72
        mem_in          : out mem_in_type;
73
        mem_out         : in mem_out_type
74
 
75
);
76
end extension;
77
 
78
architecture rtl of extension is
79
 
80
--
81
--      components:
82
--
83
 
84
component mul is
85
 
86
port (
87
        clk                     : in std_logic;
88
 
89
        ain                     : in std_logic_vector(31 downto 0);
90
        bin                     : in std_logic_vector(31 downto 0);
91
        wr                      : in std_logic;         -- write starts multiplier
92
        dout            : out std_logic_vector(31 downto 0)
93
);
94
end component mul;
95
 
96
--
97
--      signals for mulitiplier
98
--
99
        signal mul_dout                         : std_logic_vector(31 downto 0);
100
        signal mul_wr                           : std_logic;
101
 
102
--
103
--      Signals
104
--
105
        signal mem_scio_rd                      : std_logic;    -- memory or SimpCon IO read
106
        signal mem_scio_wr                      : std_logic;    -- memory or SimpCon IO write
107
        signal wraddr_wr                        : std_logic;
108
 
109
        signal wr_dly                           : std_logic;    -- generate a bsy with delayed wr
110
 
111
        signal exr                                      : std_logic_vector(31 downto 0);         -- extension data register
112
 
113
begin
114
 
115
        cmp_mul : mul
116
                        port map (clk,
117
                                ain, bin, mul_wr,
118
                                mul_dout
119
                );
120
 
121
        dout <= exr;
122
 
123
--
124
--      read
125
--
126
--      TODO: the read MUX could be set by using the
127
--      according wr/ext_addr from JOP and not the
128
--      following rd/ext_addr
129
--      Than no intermixing of mul/mem and io operations
130
--      is allowed. But we are not using interleaved mul/mem/io
131
--      operations in jvm.asm anyway.
132
--
133
--      TAKE CARE when mem_out.bcstart is read!
134
--
135
--   ** bcstart is also read without a mem_bc_rd JOP wr !!! ***
136
--              => a combinatorial mux select on rd and ext_adr==7!
137
--
138
--              The rest could be set with JOP wr start transaction 
139
--              Is this also true for io_data?
140
--
141
--      29.11.2005 evening: I think this solution driving the exr
142
--      mux from ext_addr is quite ok. The pipelining from rd/ext_adr
143
--      to A is fixed.
144
--
145
process(clk, reset)
146
begin
147
        if (reset='1') then
148
                exr <= (others => '0');
149
        elsif rising_edge(clk) then
150
 
151
                if (ext_addr=LDMRD) then
152
                        exr <= mem_out.dout;
153
                elsif (ext_addr=LDMUL) then
154
                        exr <= mul_dout;
155
                -- elsif (ext_addr=LDBCSTART) then
156
                else
157
                        exr <= mem_out.bcstart;
158
                end if;
159
 
160
        end if;
161
end process;
162
 
163
 
164
--
165
--      write
166
--
167
process(clk, reset)
168
begin
169
        if (reset='1') then
170
                mem_scio_rd <= '0';
171
                mem_scio_wr <= '0';
172
                wraddr_wr <= '0';
173
                mem_in.bc_rd <= '0';
174
                mem_in.iaload <= '0';
175
                mem_in.iastore <= '0';
176
                mem_in.getfield <= '0';
177
                mem_in.putfield <= '0';
178
                mul_wr <= '0';
179
                wr_dly <= '0';
180
 
181
 
182
        elsif rising_edge(clk) then
183
                mem_scio_rd <= '0';
184
                mem_scio_wr <= '0';
185
                wraddr_wr <= '0';
186
                mem_in.bc_rd <= '0';
187
                mem_in.iaload <= '0';
188
                mem_in.iastore <= '0';
189
                mem_in.getfield <= '0';
190
                mem_in.putfield <= '0';
191
                mem_in.copy <= '0';
192
                mul_wr <= '0';
193
 
194
                wr_dly <= wr;
195
 
196
--
197
--      wr is generated in decode and one cycle earlier than
198
--      the data to be written (e.g. read address for the memory interface)
199
--
200
                if wr='1' then
201
 
202
                        if ext_addr=STMRA then
203
                                mem_scio_rd <= '1';             -- start memory or io read
204
                        elsif ext_addr=STMWA then
205
                                wraddr_wr <= '1';               -- store write address
206
                        elsif ext_addr=STMWD then
207
                                mem_scio_wr <= '1';             -- start memory or io write
208
                        elsif ext_addr=STALD then
209
                                mem_in.iaload <= '1';   -- start an array load
210
                        elsif ext_addr=STAST then
211
                                mem_in.iastore <= '1';  -- start an array store
212
                        elsif ext_addr=STGF then
213
                                mem_in.getfield <= '1'; -- start getfield
214
                        elsif ext_addr=STPF then
215
                                mem_in.putfield <= '1'; -- start getfield
216
                        elsif ext_addr=STCP then
217
                                mem_in.copy <= '1';             -- start copy
218
                        elsif ext_addr=STMUL then
219
                                mul_wr <= '1';                  -- start multiplier
220
                        -- elsif ext_addr=STBCR then
221
                        else
222
                                mem_in.bc_rd <= '1';    -- start bc read
223
                        end if;
224
                end if;
225
 
226
        end if;
227
end process;
228
 
229
--
230
--      memory read/write
231
--
232
        mem_in.rd <= mem_scio_rd;
233
        mem_in.wr <= mem_scio_wr;
234
        mem_in.addr_wr <= wraddr_wr;
235
 
236
        -- a JOP wr generates the first bsy cycle
237
        -- the following are generated by the memory
238
        -- system or the SimpCon device
239
        bsy <= wr_dly or mem_out.bsy;
240
 
241
 
242
end rtl;

powered by: WebSVN 2.1.0

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