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

Subversion Repositories core_arm

[/] [core_arm/] [trunk/] [vhdl/] [tech/] [tech_proasic.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tarookumic
 
2
 
3
 
4
 
5
----------------------------------------------------------------------------
6
--  This file is a part of the LEON VHDL model
7
--  Copyright (C) 1999  European Space Agency (ESA)
8
--
9
--  This library is free software; you can redistribute it and/or
10
--  modify it under the terms of the GNU Lesser General Public
11
--  License as published by the Free Software Foundation; either
12
--  version 2 of the License, or (at your option) any later version.
13
--
14
--  See the file COPYING.LGPL for the full details of the license.
15
 
16
 
17
-----------------------------------------------------------------------------
18
-- Entity:      tech_proasic
19
-- File:        tech_proasic.vhd
20
-- Author:      Jiri Gaisler - Gaisler Research
21
-- Description: Ram generators for Actel ProAsic/ProAsicPlus
22
------------------------------------------------------------------------------
23
 
24
LIBRARY ieee;
25
use IEEE.std_logic_1164.all;
26
use work.leon_iface.all;
27
package tech_proasic is
28
 
29
-- generic sync ram
30
 
31
component proasic_syncram
32
  generic ( abits : integer := 10; dbits : integer := 8 );
33
  port (
34
    address  : in std_logic_vector((abits -1) downto 0);
35
    clk      : in std_logic;
36
    datain   : in std_logic_vector((dbits -1) downto 0);
37
    dataout  : out std_logic_vector((dbits -1) downto 0);
38
    enable   : in std_logic;
39
    write    : in std_logic
40
   );
41
end component;
42
 
43
-- regfile generator
44
 
45
component proasic_regfile_iu
46
  generic (
47
    rftype : integer := 1;
48
    abits : integer := 8; dbits : integer := 32; words : integer := 128
49
  );
50
  port (
51
    rst      : in std_logic;
52
    clk      : in std_logic;
53
    clkn     : in std_logic;
54
    rfi      : in rf_in_type;
55
    rfo      : out rf_out_type);
56
  end component;
57
 
58
component proasic_regfile_cp
59
  generic (
60
    abits : integer := 4; dbits : integer := 32; words : integer := 16
61
  );
62
  port (
63
    rst      : in std_logic;
64
    clk      : in std_logic;
65
    rfi      : in rf_cp_in_type;
66
    rfo      : out rf_cp_out_type);
67
end component;
68
 
69
end;
70
 
71
------------------------------------------------------------------
72
-- behavioural ram models --------------------------------------------
73
------------------------------------------------------------------
74
 
75
-- pragma translate_off
76
 
77
library IEEE;
78
use IEEE.std_logic_1164.all;
79
use work.tech_generic.all;
80
 
81
entity RAM256x9SST is
82
    port(
83
  DO8, DO7, DO6, DO5, DO4, DO3, DO2, DO1, DO0 : out std_logic;
84
  WPE, RPE, DOS : out std_logic;
85
  WADDR7, WADDR6, WADDR5, WADDR4, WADDR3, WADDR2, WADDR1, WADDR0 : in std_logic;
86
  RADDR7, RADDR6, RADDR5, RADDR4, RADDR3, RADDR2, RADDR1, RADDR0 : in std_logic;
87
  WCLKS, RCLKS : in std_logic;
88
  DI8, DI7, DI6, DI5, DI4, DI3, DI2, DI1, DI0 : in std_logic;
89
  WRB, RDB, WBLKB, RBLKB, PARODD, DIS : in std_logic);
90
end;
91
 
92
architecture rtl of RAM256x9SST is
93
  signal d, q : std_logic_vector(8 downto 0);
94
  signal wa, ra : std_logic_vector(7 downto 0);
95
  signal wen : std_logic;
96
begin
97
  wen <= not (WBLKB or WRB);
98
  wa  <= WADDR7 & WADDR6 & WADDR5 & WADDR4 & WADDR3 & WADDR2 & WADDR1 & WADDR0;
99
  ra  <= RADDR7 & RADDR6 & RADDR5 & RADDR4 & RADDR3 & RADDR2 & RADDR1 & RADDR0;
100
  d   <= DI8 & DI7 & DI6 & DI5 & DI4 & DI3 & DI2 & DI1 & DI0;
101
  u0 : generic_dpram_ss generic map (abits => 8, dbits => 9, words => 256)
102
       port map (clk => WCLKS, rdaddress => ra, wraddress => wa,
103
                 data => d, wren => wen, q => q);
104
  DO8 <= q(8); DO7 <= q(7); DO6 <= q(6); DO5 <= q(5); DO4 <= q(4);
105
  DO3 <= q(3); DO2 <= q(2); DO1 <= q(1); DO0 <= q(0);
106
 
107
end;
108
 
109
library IEEE;
110
use IEEE.std_logic_1164.all;
111
use work.tech_generic.all;
112
 
113
entity RAM256x9SA is
114
    port(
115
  DO0, DO1, DO2, DO3, DO4, DO5, DO6, DO7, DO8 : out std_logic;
116
  DOS, RPE, WPE : out std_logic;
117
  WADDR0, WADDR1, WADDR2, WADDR3, WADDR4, WADDR5, WADDR6, WADDR7 : in std_logic;
118
  RADDR0, RADDR1, RADDR2, RADDR3, RADDR4, RADDR5, RADDR6, RADDR7 : in std_logic;
119
  WCLKS : in std_logic;
120
  DI0, DI1, DI2, DI3, DI4, DI5, DI6, DI7, DI8 : in std_logic;
121
  RDB, WRB, RBLKB, WBLKB, PARODD, DIS : in std_logic);
122
end;
123
 
124
architecture rtl of RAM256x9SA is
125
  signal d, q : std_logic_vector(8 downto 0);
126
  signal wa, ra : std_logic_vector(7 downto 0);
127
  signal wen : std_logic;
128
begin
129
  wen <= not (WBLKB or WRB);
130
  wa  <= WADDR7 & WADDR6 & WADDR5 & WADDR4 & WADDR3 & WADDR2 & WADDR1 & WADDR0;
131
  ra  <= RADDR7 & RADDR6 & RADDR5 & RADDR4 & RADDR3 & RADDR2 & RADDR1 & RADDR0;
132
  d   <= DI8 & DI7 & DI6 & DI5 & DI4 & DI3 & DI2 & DI1 & DI0;
133
  u0 : generic_dpram_as generic map (abits => 8, dbits => 9, words => 256)
134
       port map (clk => WCLKS, rdaddress => ra, wraddress => wa,
135
                 data => d, wren => wen, q => q);
136
  DO8 <= q(8); DO7 <= q(7); DO6 <= q(6); DO5 <= q(5); DO4 <= q(4);
137
  DO3 <= q(3); DO2 <= q(2); DO1 <= q(1); DO0 <= q(0);
138
 
139
end;
140
 
141
-- pragma translate_on
142
 
143
--------------------------------------------------------------------
144
-- regfile generators
145
--------------------------------------------------------------------
146
 
147
-- integer unit regfile
148
LIBRARY ieee;
149
use IEEE.std_logic_1164.all;
150
use work.leon_config.all;
151
use work.leon_iface.all;
152
entity proasic_regfile_iu is
153
  generic (
154
    rftype : integer := 1;
155
    abits : integer := 8; dbits : integer := 32; words : integer := 128
156
  );
157
  port (
158
    rst      : in std_logic;
159
    clk      : in std_logic;
160
    clkn     : in std_logic;
161
    rfi      : in rf_in_type;
162
    rfo      : out rf_out_type);
163
end;
164
 
165
architecture rtl of proasic_regfile_iu is
166
  component RAM256x9SA port(
167
    DO0, DO1, DO2, DO3, DO4, DO5, DO6, DO7, DO8 : out std_logic;
168
    DOS, RPE, WPE : out std_logic;
169
    WADDR0, WADDR1, WADDR2, WADDR3, WADDR4, WADDR5, WADDR6, WADDR7 : in std_logic;
170
    RADDR0, RADDR1, RADDR2, RADDR3, RADDR4, RADDR5, RADDR6, RADDR7 : in std_logic;
171
    WCLKS : in std_logic;
172
    DI0, DI1, DI2, DI3, DI4, DI5, DI6, DI7, DI8 : in std_logic;
173
    RDB, WRB, RBLKB, WBLKB, PARODD, DIS : in std_logic);
174
  end component;
175
signal wen, gnd : std_logic;
176
signal wa, ra1, ra2 : std_logic_vector(15 downto 0);
177
begin
178
 
179
  wen <= not rfi.wren; gnd <= '0';
180
  wa(15 downto abits) <= (others => '0');
181
  wa(abits-1 downto 0) <=  rfi.wraddr(abits-1 downto 0);
182
  ra1(15 downto abits) <= (others => '0');
183
  ra1(abits-1 downto 0) <=  rfi.rd1addr(abits-1 downto 0);
184
  ra2(15 downto abits) <= (others => '0');
185
  ra2(abits-1 downto 0) <=  rfi.rd2addr(abits-1 downto 0);
186
 
187
  g0 : for i in 0 to 3 generate
188
    u0 : RAM256x9SA port map (
189
      DO0 => rfo.data1(i*8 + 0), DO1 => rfo.data1(i*8 + 1),
190
      DO2 => rfo.data1(i*8 + 2), DO3 => rfo.data1(i*8 + 3),
191
      DO4 => rfo.data1(i*8 + 4), DO5 => rfo.data1(i*8 + 5),
192
      DO6 => rfo.data1(i*8 + 6), DO7 => rfo.data1(i*8 + 7), DO8 => open,
193
      DOS => open, RPE => open, WPE => open,
194
      WADDR0 => wa(0), WADDR1 => wa(1), WADDR2 => wa(2), WADDR3 => wa(3),
195
      WADDR4 => wa(4), WADDR5 => wa(5), WADDR6 => wa(6), WADDR7 => wa(7),
196
      RADDR0 => ra1(0), RADDR1 => ra1(1), RADDR2 => ra1(2), RADDR3 => ra1(3),
197
      RADDR4 => ra1(4), RADDR5 => ra1(5), RADDR6 => ra1(6), RADDR7 => ra1(7),
198
      WCLKS => clk,
199
      DI0 => rfi.wrdata(i*8 + 0), DI1 => rfi.wrdata(i*8 + 1),
200
      DI2 => rfi.wrdata(i*8 + 2), DI3 => rfi.wrdata(i*8 + 3),
201
      DI4 => rfi.wrdata(i*8 + 4), DI5 => rfi.wrdata(i*8 + 5),
202
      DI6 => rfi.wrdata(i*8 + 6), DI7 => rfi.wrdata(i*8 + 7), DI8 => gnd,
203
      RDB => gnd, WRB => wen, RBLKB => gnd, WBLKB => wen, PARODD => gnd,
204
      DIS => gnd);
205
    u1 : RAM256x9SA port map (
206
      DO0 => rfo.data2(i*8 + 0), DO1 => rfo.data2(i*8 + 1),
207
      DO2 => rfo.data2(i*8 + 2), DO3 => rfo.data2(i*8 + 3),
208
      DO4 => rfo.data2(i*8 + 4), DO5 => rfo.data2(i*8 + 5),
209
      DO6 => rfo.data2(i*8 + 6), DO7 => rfo.data2(i*8 + 7), DO8 => open,
210
      DOS => open, RPE => open, WPE => open,
211
      WADDR0 => wa(0), WADDR1 => wa(1), WADDR2 => wa(2), WADDR3 => wa(3),
212
      WADDR4 => wa(4), WADDR5 => wa(5), WADDR6 => wa(6), WADDR7 => wa(7),
213
      RADDR0 => ra2(0), RADDR1 => ra2(1), RADDR2 => ra2(2), RADDR3 => ra2(3),
214
      RADDR4 => ra2(4), RADDR5 => ra2(5), RADDR6 => ra2(6), RADDR7 => ra2(7),
215
      WCLKS => clk,
216
      DI0 => rfi.wrdata(i*8 + 0), DI1 => rfi.wrdata(i*8 + 1),
217
      DI2 => rfi.wrdata(i*8 + 2), DI3 => rfi.wrdata(i*8 + 3),
218
      DI4 => rfi.wrdata(i*8 + 4), DI5 => rfi.wrdata(i*8 + 5),
219
      DI6 => rfi.wrdata(i*8 + 6), DI7 => rfi.wrdata(i*8 + 7), DI8 => gnd,
220
      RDB => gnd, WRB => wen, RBLKB => gnd, WBLKB => wen, PARODD => gnd,
221
      DIS => gnd);
222
    end generate;
223
end;
224
 
225
-- co-processor regfile
226
-- synchronous operation without write-through support
227
LIBRARY ieee;
228
use IEEE.std_logic_1164.all;
229
use work.leon_config.all;
230
use work.leon_iface.all;
231
entity proasic_regfile_cp is
232
  generic (
233
    abits : integer := 4; dbits : integer := 32; words : integer := 16
234
  );
235
  port (
236
    rst      : in std_logic;
237
    clk      : in std_logic;
238
    rfi      : in rf_cp_in_type;
239
    rfo      : out rf_cp_out_type);
240
end;
241
 
242
architecture rtl of proasic_regfile_cp is
243
  component RAM256x9SST port(
244
    DO8, DO7, DO6, DO5, DO4, DO3, DO2, DO1, DO0 : out std_logic;
245
    WPE, RPE, DOS : out std_logic;
246
    WADDR7, WADDR6, WADDR5, WADDR4, WADDR3, WADDR2, WADDR1, WADDR0 : in std_logic;
247
    RADDR7, RADDR6, RADDR5, RADDR4, RADDR3, RADDR2, RADDR1, RADDR0 : in std_logic;
248
    WCLKS, RCLKS : in std_logic;
249
    DI8, DI7, DI6, DI5, DI4, DI3, DI2, DI1, DI0 : in std_logic;
250
    WRB, RDB, WBLKB, RBLKB, PARODD, DIS : in std_logic);
251
  end component;
252
  signal wen, gnd : std_logic;
253
begin
254
  wen <= not rfi.wren; gnd <= '0';
255
  g0 : for i in 0 to 3 generate
256
    u0 : RAM256x9SST port map (
257
      DO0 => rfo.data1(i*8 + 0), DO1 => rfo.data1(i*8 + 1),
258
      DO2 => rfo.data1(i*8 + 2), DO3 => rfo.data1(i*8 + 3),
259
      DO4 => rfo.data1(i*8 + 4), DO5 => rfo.data1(i*8 + 5),
260
      DO6 => rfo.data1(i*8 + 6), DO7 => rfo.data1(i*8 + 7), DO8 => open,
261
      DOS => open, RPE => open, WPE => open,
262
      WADDR0 => rfi.wraddr(0), WADDR1 => rfi.wraddr(1), WADDR2 => rfi.wraddr(2),
263
      WADDR3 => rfi.wraddr(3), WADDR4 => gnd, WADDR5 => gnd,
264
      WADDR6 => gnd, WADDR7 => gnd,
265
      RADDR0 => rfi.rd1addr(0), RADDR1 => rfi.rd1addr(1), RADDR2 => rfi.rd1addr(2),
266
      RADDR3 => rfi.rd1addr(3), RADDR4 => gnd, RADDR5 => gnd,
267
      RADDR6 => gnd, RADDR7 => gnd,
268
      WCLKS => clk, RCLKS => clk,
269
      DI0 => rfi.wrdata(i*8 + 0), DI1 => rfi.wrdata(i*8 + 1),
270
      DI2 => rfi.wrdata(i*8 + 2), DI3 => rfi.wrdata(i*8 + 3),
271
      DI4 => rfi.wrdata(i*8 + 4), DI5 => rfi.wrdata(i*8 + 5),
272
      DI6 => rfi.wrdata(i*8 + 6), DI7 => rfi.wrdata(i*8 + 7), DI8 => gnd,
273
      RDB => gnd, WRB => wen, RBLKB => gnd, WBLKB => wen, PARODD => gnd,
274
      DIS => gnd);
275
    u1 : RAM256x9SST port map (
276
      DO0 => rfo.data2(i*8 + 0), DO1 => rfo.data2(i*8 + 1),
277
      DO2 => rfo.data2(i*8 + 2), DO3 => rfo.data2(i*8 + 3),
278
      DO4 => rfo.data2(i*8 + 4), DO5 => rfo.data2(i*8 + 5),
279
      DO6 => rfo.data2(i*8 + 6), DO7 => rfo.data2(i*8 + 7), DO8 => open,
280
      DOS => open, RPE => open, WPE => open,
281
      WADDR0 => rfi.wraddr(0), WADDR1 => rfi.wraddr(1), WADDR2 => rfi.wraddr(2),
282
      WADDR3 => gnd, WADDR4 => gnd, WADDR5 => gnd,
283
      WADDR6 => gnd, WADDR7 => gnd,
284
      RADDR0 => rfi.rd2addr(0), RADDR1 => rfi.rd2addr(1), RADDR2 => rfi.rd2addr(2),
285
      RADDR3 => rfi.rd2addr(3), RADDR4 => gnd, RADDR5 => gnd,
286
      RADDR6 => gnd, RADDR7 => gnd, WCLKS => clk, RCLKS => clk,
287
      DI0 => rfi.wrdata(i*8 + 0), DI1 => rfi.wrdata(i*8 + 1),
288
      DI2 => rfi.wrdata(i*8 + 2), DI3 => rfi.wrdata(i*8 + 3),
289
      DI4 => rfi.wrdata(i*8 + 4), DI5 => rfi.wrdata(i*8 + 5),
290
      DI6 => rfi.wrdata(i*8 + 6), DI7 => rfi.wrdata(i*8 + 7), DI8 => gnd,
291
      RDB => gnd, WRB => wen, RBLKB => gnd, WBLKB => wen, PARODD => gnd,
292
      DIS => gnd);
293
    end generate;
294
end;
295
 
296
LIBRARY ieee;
297
use IEEE.std_logic_1164.all;
298
use IEEE.std_logic_arith.all;
299
use work.leon_config.all;
300
use work.leon_iface.all;
301
entity proasic_syncram is
302
  generic ( abits : integer := 10; dbits : integer := 8 );
303
  port (
304
    address  : in std_logic_vector((abits -1) downto 0);
305
    clk      : in std_logic;
306
    datain   : in std_logic_vector((dbits -1) downto 0);
307
    dataout  : out std_logic_vector((dbits -1) downto 0);
308
    enable   : in std_logic;
309
    write    : in std_logic
310
   );
311
end;
312
 
313
architecture rtl of proasic_syncram is
314
  component RAM256x9SST port(
315
    DO8, DO7, DO6, DO5, DO4, DO3, DO2, DO1, DO0 : out std_logic;
316
    WPE, RPE, DOS : out std_logic;
317
    WADDR7, WADDR6, WADDR5, WADDR4, WADDR3, WADDR2, WADDR1, WADDR0 : in std_logic;
318
    RADDR7, RADDR6, RADDR5, RADDR4, RADDR3, RADDR2, RADDR1, RADDR0 : in std_logic;
319
    WCLKS, RCLKS : in std_logic;
320
    DI8, DI7, DI6, DI5, DI4, DI3, DI2, DI1, DI0 : in std_logic;
321
    WRB, RDB, WBLKB, RBLKB, PARODD, DIS : in std_logic);
322
  end component;
323
  type powarr is array (0 to 6) of integer;
324
  constant powtbl : powarr := (0, 1, 3, 7, 15, 31, 63);
325
  subtype word is std_logic_vector(63 downto 0);
326
  type qarr is array (0 to 63) of word;
327
  signal gnd : std_logic;
328
  signal q : qarr;
329
  signal d : word;
330
  signal a, rra : word;
331
  signal wen : std_logic_vector (63 downto 0);
332
begin
333
  gnd <= '0';
334
  a(63 downto abits) <= (others => '0');
335
  a(abits-1 downto 0) <= address;
336
  d(63 downto dbits) <= (others => '0');
337
  d(dbits-1 downto 0) <= datain;
338
  x0 : if abits > 8 generate
339
    b0 : for j in 0 to powtbl(abits-8) generate
340
     g0 : for i in 0 to (dbits-1)/9 generate
341
      u0 : RAM256x9SST port map (
342
      DO0 => q(j)(i*9+0), DO1 => q(j)(i*9+1), DO2 => q(j)(i*9+2),
343
      DO3 => q(j)(i*9+3), DO4 => q(j)(i*9+4), DO5 => q(j)(i*9+5),
344
      DO6 => q(j)(i*9+6), DO7 => q(j)(i*9+7), DO8 => q(j)(i*9+8),
345
      DOS => open, RPE => open, WPE => open,
346
      WADDR0 => a(0), WADDR1 => a(1), WADDR2 => a(2),
347
      WADDR3 => a(3), WADDR4 => a(4), WADDR5 => a(5),
348
      WADDR6 => a(6), WADDR7 => a(7),
349
      RADDR0 => a(0), RADDR1 => a(1), RADDR2 => a(2),
350
      RADDR3 => a(3), RADDR4 => a(4), RADDR5 => a(5),
351
      RADDR6 => a(6), RADDR7 => a(7),
352
      WCLKS => clk, RCLKS => clk,
353
      DI0 => d(i*9+0), DI1 => d(i*9+1), DI2 => d(i*9+2),
354
      DI3 => d(i*9+3), DI4 => d(i*9+4), DI5 => d(i*9+5),
355
      DI6 => d(i*9+6), DI7 => d(i*9+7), DI8 => d(i*9+8),
356
      RDB => gnd, WRB => wen(j), RBLKB => gnd, WBLKB => wen(j), PARODD => gnd,
357
      DIS => gnd);
358
     end generate;
359
   end generate;
360
 
361
    reg : process(clk)
362
    begin
363
      if rising_edge(clk) then
364
        rra(abits-9 downto 0) <= address(abits-1 downto 8);
365
      end if;
366
    end process;
367
 
368
    ctrl : process(write, address, q, rra)
369
    variable we,z : std_logic_vector(63 downto 0);
370
    begin
371
      we := (others => '0');
372
      z := (others => '0');
373
-- pragma translate_off
374
      if not is_x(rra(abits-9 downto 0)) then
375
-- pragma translate_on
376
        z(dbits-1 downto 0) := q(conv_integer(unsigned(rra(abits-9 downto 0))))(dbits-1 downto 0);
377
-- pragma translate_off
378
      end if;
379
      if not is_x(address(abits-1 downto 8)) then
380
-- pragma translate_on
381
        we (conv_integer(unsigned(address(abits-1 downto 8)))) := write;
382
-- pragma translate_off
383
      end if;
384
-- pragma translate_on
385
      wen <= not we;
386
      dataout <= z(dbits-1 downto 0);
387
    end process;
388
 
389
  end generate;
390
 
391
  asz8 : if abits <= 8 generate
392
    g0 : for i in 0 to (dbits-1)/9 generate
393
      u0 : RAM256x9SST port map (
394
      DO0 => q(0)(i*9+0), DO1 => q(0)(i*9+1), DO2 => q(0)(i*9+2),
395
      DO3 => q(0)(i*9+3), DO4 => q(0)(i*9+4), DO5 => q(0)(i*9+5),
396
      DO6 => q(0)(i*9+6), DO7 => q(0)(i*9+7), DO8 => q(0)(i*9+8),
397
      DOS => open, RPE => open, WPE => open,
398
      WADDR0 => a(0), WADDR1 => a(1), WADDR2 => a(2),
399
      WADDR3 => a(3), WADDR4 => a(4), WADDR5 => a(5),
400
      WADDR6 => a(6), WADDR7 => a(7),
401
      RADDR0 => a(0), RADDR1 => a(1), RADDR2 => a(2),
402
      RADDR3 => a(3), RADDR4 => a(4), RADDR5 => a(5),
403
      RADDR6 => a(6), RADDR7 => a(7),
404
      WCLKS => clk, RCLKS => clk,
405
      DI0 => d(i*9+0), DI1 => d(i*9+1), DI2 => d(i*9+2),
406
      DI3 => d(i*9+3), DI4 => d(i*9+4), DI5 => d(i*9+5),
407
      DI6 => d(i*9+6), DI7 => d(i*9+7), DI8 => d(i*9+8),
408
      RDB => gnd, WRB => wen(0), RBLKB => gnd, WBLKB => wen(0), PARODD => gnd,
409
      DIS => gnd);
410
    end generate;
411
    wen(0) <= not write;
412
    dataout <= q(0)(dbits-1 downto 0);
413
  end generate;
414
 
415
end;

powered by: WebSVN 2.1.0

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