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

Subversion Repositories g729a_codec

[/] [g729a_codec/] [trunk/] [VHDL/] [G729A_asip_top_2w.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 madsilicon
-----------------------------------------------------------------
2
--                                                             --
3
-----------------------------------------------------------------
4
--                                                             --
5
-- Copyright (C) 2013 Stefano Tonello                          --
6
--                                                             --
7
-- This source file may be used and distributed without        --
8
-- restriction provided that this copyright statement is not   --
9
-- removed from the file and that any derivative work contains --
10
-- the original copyright notice and the associated disclaimer.--
11
--                                                             --
12
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY         --
13
-- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   --
14
-- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   --
15
-- FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      --
16
-- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         --
17
-- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    --
18
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   --
19
-- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        --
20
-- BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  --
21
-- LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  --
22
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  --
23
-- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         --
24
-- POSSIBILITY OF SUCH DAMAGE.                                 --
25
--                                                             --
26
-----------------------------------------------------------------
27
 
28
---------------------------------------------------------------
29
-- G729A ASIP top-level module
30
---------------------------------------------------------------
31
 
32
library IEEE;
33
use IEEE.std_logic_1164.all;
34
use IEEE.numeric_std.all;
35
use STD.textio.all;
36
 
37
library WORK;
38
use work.G729A_ASIP_PKG.all;
39
use work.G729A_ASIP_CFG_PKG.all;
40
 
41
entity G729A_ASIP_TOP_2W is
42
  generic(
43
    -- synthesis translate_off
44
    ST_FILE : string := "NONE";
45
    WB_FILE : string := "NONE";
46
    -- synthesis translate_on
47
    USE_ROM_MIF : std_logic := '0';
48
    SIMULATION_ONLY : std_logic := '0'
49
  );
50
  port(
51
    CLK_i : in std_logic; -- clock
52
    RST_i : in std_logic; -- reset
53
    STRT_i : in std_logic; -- start
54
    SADR_i : in std_logic_vector(ALEN-1 downto 0);
55
    SRST_i : in std_logic; -- soft_reset
56
    DIWE_i : in std_logic; -- data-in write-enable
57
    DI_i : in std_logic_vector(SDLEN-1 downto 0); -- data-in
58
    DORE_i : in std_logic; -- data-out read-enable
59
    CHK_ENB_i : in std_logic; -- check-enable
60
    XDMAE_i : in std_logic; -- DMA enable
61
    XWE_i : in std_logic; -- DMA write-enable
62
    XADR_i : in std_logic_vector(ALEN-1 downto 0);
63
    XDI_i : in std_logic_vector(SDLEN-1 downto 0); -- DMA data-in
64
 
65
    BSY_o : out std_logic; -- busy
66
    DIV_o : out std_logic; --
67
    DOV_o : out std_logic; --
68
    DO_o : out std_logic_vector(SDLEN-1 downto 0); -- data-out
69
    XDO_o : out std_logic_vector(SDLEN-1 downto 0) -- DMA data-out
70
  );
71
end G729A_ASIP_TOP_2W;
72
 
73
architecture ARC of G729A_ASIP_TOP_2W is
74
 
75
  --constant CMEM_LIMIT : natural := 1024*3;
76
  constant IO_INTF_PRESENT : std_logic := '0';
77
  constant MEM_LIMIT : natural := 1024*64-1;
78
  constant IOMEM_SIZE : natural := 128;
79
  constant IOMEM_LIMIT : natural := MEM_LIMIT - IOMEM_SIZE;
80
 
81
  component G729A_ASIP_CPU_2W is
82
    generic(
83
      -- synthesis translate_off
84
      ST_FILENAME : string := "NONE";
85
      WB_FILENAME : string := "NONE";
86
      -- synthesis translate_on
87
      SIMULATION_ONLY : std_logic := '1'
88
    );
89
    port(
90
      CLK_i : in std_logic;
91
      RST_i : in std_logic;
92
      STRT_i : in std_logic;
93
      SADR_i : in unsigned(ALEN-1 downto 0);
94
      -- instruction memory interface
95
      INSTR_i : in std_logic_vector(ILEN*2-1 downto 0);
96
      -- data memory interface
97
      DDAT0_i : in std_logic_vector(SDLEN-1 downto 0);
98
      DDAT1_i : in std_logic_vector(SDLEN-1 downto 0);
99
      CHK_ENB_i : in std_logic;
100
 
101
      BSY_o : out std_logic;
102
      -- instruction memory interface
103
      IADR_o : out unsigned(ALEN-2 downto 0);
104
      -- data memory interface
105
      DRE_o : out std_logic_vector(2-1 downto 0);
106
      DWE0_o : out std_logic;
107
      DADR0_o : out unsigned(ALEN-1 downto 0);
108
      DADR1_o : out unsigned(ALEN-1 downto 0);
109
      DDAT0_o : out std_logic_vector(SDLEN-1 downto 0)
110
    );
111
  end component;
112
 
113
  component G729A_ASIP_ROM_MIF is
114
    generic(
115
      WCOUNT : natural := 256;
116
      DATA_WIDTH : natural := 8;
117
      ADDR_WIDTH : natural := 8;
118
      ROM_INIT_FILE : string := "NONE"
119
    );
120
    port(
121
      CLK_i : in std_logic;
122
      A_i : in unsigned(ADDR_WIDTH-1 downto 0);
123
 
124
      Q_o : out std_logic_vector(DATA_WIDTH-1 downto 0)
125
    );
126
  end component;
127
 
128
  component G729A_ASIP_ROMI is
129
    generic(
130
      WCOUNT : natural := 256;
131
      DATA_WIDTH : natural := 8;
132
      ADDR_WIDTH : natural := 8
133
    );
134
    port(
135
      CLK_i : in std_logic;
136
      A_i : in unsigned(ADDR_WIDTH-1 downto 0);
137
 
138
      Q_o : out std_logic_vector(DATA_WIDTH-1 downto 0)
139
    );
140
  end component;
141
 
142
  component G729A_ASIP_ROM_MIF_2R is
143
    generic(
144
      WCOUNT : natural := 256;
145
      DATA_WIDTH : natural := 8;
146
      ADDR_WIDTH : natural := 8;
147
      ROM_INIT_FILE : string := "NONE"
148
    );
149
    port(
150
      CLK_i : in std_logic;
151
      A0_i : in unsigned(ADDR_WIDTH-1 downto 0);
152
      A1_i : in unsigned(ADDR_WIDTH-1 downto 0);
153
 
154
      Q0_o : out std_logic_vector(DATA_WIDTH-1 downto 0);
155
      Q1_o : out std_logic_vector(DATA_WIDTH-1 downto 0)
156
    );
157
  end component;
158
 
159
  component G729A_ASIP_ROMD is
160
    generic(
161
      WCOUNT : natural := 256;
162
      DATA_WIDTH : natural := 8;
163
      ADDR_WIDTH : natural := 8
164
    );
165
    port(
166
      CLK_i : in std_logic;
167
      A0_i : in unsigned(ADDR_WIDTH-1 downto 0);
168
      A1_i : in unsigned(ADDR_WIDTH-1 downto 0);
169
 
170
      Q0_o : out std_logic_vector(DATA_WIDTH-1 downto 0);
171
      Q1_o : out std_logic_vector(DATA_WIDTH-1 downto 0)
172
    );
173
  end component;
174
 
175
  component G729_ASIP_RAM_1RW1R is
176
    generic(
177
      -- I/O data bus width
178
      DWIDTH : integer := 16;
179
      -- word count
180
      WCOUNT : integer := 256
181
    );
182
    port(
183
      CLK_i : in std_logic;
184
      A_i : in unsigned(log2(WCOUNT)-1 downto 0);
185
      DPRA_i : in unsigned(log2(WCOUNT)-1 downto 0);
186
      D_i : in std_logic_vector(DWIDTH-1 downto 0);
187
      WE_i : in std_logic;
188
 
189
      Q_o : out std_logic_vector(DWIDTH-1 downto 0);
190
      DPQ_o : out std_logic_vector(DWIDTH-1 downto 0)
191
    );
192
  end component;
193
 
194
  component G729A_ASIP_IO_INTF is
195
    generic(
196
      MEM_LIMIT : natural := 0
197
    );
198
    port(
199
      CLK_i : in std_logic;
200
      RST_i : in std_logic;
201
      CPU_ADR_i : in unsigned(ALEN-1 downto 0);
202
      CPU_RE_i : in std_logic;
203
      CPU_WE_i : in std_logic;
204
      EXT_RE_i : in std_logic;
205
      EXT_WE_i : in std_logic;
206
      CPU_DI_i : in std_logic_vector(SDLEN-1 downto 0);
207
      EXT_DI_i : in std_logic_vector(SDLEN-1 downto 0);
208
 
209
      DIV_o : out std_logic;
210
      DOV_o : out std_logic;
211
      CPU_DO_o : out std_logic_vector(SDLEN-1 downto 0);
212
      EXT_DO_o : out std_logic_vector(SDLEN-1 downto 0)
213
    );
214
  end component;
215
 
216
  -- convert std_logic_vector type to signed type
217
  function to_signed(V : std_logic_vector) return signed is
218
    variable S : signed(V'HIGH downto V'LOW);
219
  begin
220
    for i in V'HIGH downto V'LOW loop
221
      S(i) := V(i);
222
    end loop;
223
    return(S);
224
  end function;
225
 
226
  -- sign-extend
227
  function EXTS(V : std_logic_vector; L : natural) return std_logic_vector is
228
    variable XV : std_logic_vector(L-1 downto 0);
229
  begin
230
    XV(V'HIGH downto 0) := V;
231
    XV(L-1 downto V'HIGH+1) := (others => V(V'HIGH));
232
    return(XV);
233
  end function;
234
 
235
  function get_dadr_ram(DADR : unsigned(ALEN-1 downto 0)) return unsigned is
236
    variable DADR_RAM : unsigned(12-1 downto 0);
237
  begin
238 3 madsilicon
    --if(DADR(11 downto 10) /= "11") then
239
    --  DADR_RAM(11 downto 10) := DADR(11 downto 10);
240
    --else
241
    --  DADR_RAM(11 downto 10) := "00";
242
    --end if;
243
    --DADR_RAM(9 downto 0) := DADR(9 downto 0);
244
    DADR_RAM(11 downto 0) := DADR(11 downto 0);
245 2 madsilicon
    return(DADR_RAM);
246
  end function;
247
 
248
  function get_dadr_rom(DADR : unsigned(ALEN-1 downto 0)) return unsigned is
249
    variable DADR_ROM : unsigned(12-1 downto 0);
250
  begin
251
    case DADR(12 downto 10) is
252
      when "100" => DADR_ROM(11 downto 10) := "01";
253
      when "101" => DADR_ROM(11 downto 10) := "10";
254
      when others => DADR_ROM(11 downto 10) := "00";
255
    end case;
256
    DADR_ROM(9 downto 0) := DADR(9 downto 0);
257
    return(DADR_ROM);
258
  end function;
259
 
260
  function sel_data(
261
    DI_ROM,DI_IO,DI_RAM : std_logic_vector(SDLEN-1 downto 0);
262
    ROM_SEL,IO_SEL : std_logic) return std_logic_vector is
263
  begin
264
    if(ROM_SEL = '1') then
265
      return(DI_ROM);
266
    elsif(IO_SEL = '1') then
267
      return(DI_IO);
268
    else
269
      return(DI_RAM);
270
    end if;
271
  end function;
272
 
273
  signal STRT_q : std_logic;
274
  signal SADR_q : unsigned(ALEN-1 downto 0);
275
  signal INSTR : std_logic_vector(ILEN*2-1 downto 0);
276
  signal DDATI0 : std_logic_vector(SDLEN-1 downto 0);
277
  signal DDATI1 : std_logic_vector(SDLEN-1 downto 0);
278
  signal BSY : std_logic;
279
  signal IADR : unsigned(ALEN-2 downto 0);
280
  signal DWE0 : std_logic;
281
  signal DRE : std_logic_vector(2-1 downto 0);
282
  signal DADR0 : unsigned(ALEN-1 downto 0);
283
  signal DADR1 : unsigned(ALEN-1 downto 0);
284
  signal DDATO : std_logic_vector(SDLEN-1 downto 0);
285
 
286
  signal DROM0_SEL,DROM1_SEL : std_logic;
287
  signal DROM0_SEL_q,DROM1_SEL_q : std_logic;
288
  signal DWE0_RAM : std_logic;
289 3 madsilicon
  --signal DADR0_RAM : unsigned(log2(CMEM_LIMIT)-1 downto 0);
290
  --signal DADR1_RAM : unsigned(log2(CMEM_LIMIT)-1 downto 0);
291
  --signal DADR0_ROM : unsigned(log2(DMEM_SIZE-CMEM_LIMIT)-1 downto 0);
292
  --signal DADR1_ROM : unsigned(log2(DMEM_SIZE-CMEM_LIMIT)-1 downto 0);
293
  signal DADR0_ROM : unsigned(log2(CMEM_LIMIT)-1 downto 0);
294
  signal DADR1_ROM : unsigned(log2(CMEM_LIMIT)-1 downto 0);
295
  signal DADR0_RAM : unsigned(log2(DMEM_SIZE-CMEM_LIMIT)-1 downto 0);
296
  signal DADR1_RAM : unsigned(log2(DMEM_SIZE-CMEM_LIMIT)-1 downto 0);
297 2 madsilicon
  signal DDATI0_RAM : std_logic_vector(SDLEN-1 downto 0);
298
  signal DDATI1_RAM : std_logic_vector(SDLEN-1 downto 0);
299
  signal DDATI0_ROM : std_logic_vector(SDLEN-1 downto 0);
300
  signal DDATI1_ROM : std_logic_vector(SDLEN-1 downto 0);
301
 
302
  signal IOMEM0_SEL,IOMEM1_SEL : std_logic;
303
  signal IOMEM0_SEL_q,IOMEM1_SEL_q : std_logic;
304
  signal DI_q,DO_q : std_logic_vector(SDLEN-1 downto 0);
305
  signal DIV_q,DOV_q : std_logic;
306
  signal DDATI_IO : std_logic_vector(SDLEN-1 downto 0);
307
  signal DDATI_IO_q : std_logic_vector(SDLEN-1 downto 0);
308
 
309
  signal DDI_RAM : std_logic_vector(SDLEN-1 downto 0);
310
 
311
begin
312
 
313
  ---------------------------------------------------
314
  -- ASIP Core
315
  ---------------------------------------------------
316
 
317
  process(CLK_i)
318
  begin
319
    if(CLK_i = '1' and CLK_i'event) then
320
      if(RST_i = '1') then
321
        STRT_q <= '0';
322
      else
323
        STRT_q <= STRT_i;
324
      end if;
325
      SADR_q <= to_unsigned(SADR_i);
326
    end if;
327
  end process;
328
 
329
  U_ASIP : G729A_ASIP_CPU_2W
330
    generic map(
331
      -- synthesis translate_off
332
      ST_FILENAME => ST_FILE,
333
      WB_FILENAME => WB_FILE,
334
      -- synthesis translate_on
335
      SIMULATION_ONLY => SIMULATION_ONLY
336
    )
337
    port map(
338
      CLK_i => CLK_i,
339
      RST_i => RST_i,
340
      STRT_i => STRT_q,
341
      SADR_i => SADR_q,
342
      INSTR_i => INSTR,
343
      DDAT0_i => DDATI0,
344
      DDAT1_i => DDATI1,
345
      CHK_ENB_i => CHK_ENB_i,
346
 
347
      BSY_o => BSY,
348
      IADR_o => IADR,
349
      DRE_o => DRE,
350
      DWE0_o => DWE0,
351
      DADR0_o => DADR0,
352
      DADR1_o => DADR1,
353
      DDAT0_o => DDATO
354
    );
355
 
356
  BSY_o <= BSY;
357
 
358
  ---------------------------------------------------
359
  -- Data memory selections signals
360
  ---------------------------------------------------
361
 
362
  G0_T : if(IO_INTF_PRESENT = '1') generate
363
 
364
  DROM0_SEL <= '1' when
365
    (DADR0 >= CMEM_LIMIT and DADR0 < IOMEM_LIMIT) else '0';
366
 
367
  DROM1_SEL <= '1' when
368
    (DADR1 >= CMEM_LIMIT and DADR1 < IOMEM_LIMIT) else '0';
369
 
370
  end generate;
371
 
372
  G0_F : if(IO_INTF_PRESENT = '0') generate
373
 
374
  DROM0_SEL <= '1' when
375
    (DADR0 >= CMEM_LIMIT) else '0';
376
 
377
  DROM1_SEL <= '1' when
378
    (DADR1 >= CMEM_LIMIT) else '0';
379
 
380
  end generate;
381
 
382
  -- registered DROM_SEL (needed to select ASIP data-in)
383
  process(CLK_i)
384
  begin
385
    if(CLK_i = '1' and CLK_i'event) then
386
      DROM0_SEL_q <= DROM0_SEL;
387
      DROM1_SEL_q <= DROM1_SEL;
388
    end if;
389
  end process;
390
 
391
  G1_T : if(IO_INTF_PRESENT = '1') generate
392
 
393
  IOMEM0_SEL <= '1' when (DADR0 >= IOMEM_LIMIT) else '0';
394
  IOMEM1_SEL <= '1' when (DADR1 >= IOMEM_LIMIT) else '0';
395
 
396
  end generate;
397
 
398
  G1_F : if(IO_INTF_PRESENT = '0') generate
399
 
400
  IOMEM0_SEL <= '0';
401
  IOMEM1_SEL <= '0';
402
 
403
  end generate;
404
 
405
  -- registered IOMEM_SEL (needed to select ASIP data-in)
406
  process(CLK_i)
407
  begin
408
    if(CLK_i = '1' and CLK_i'event) then
409
      IOMEM0_SEL_q <= IOMEM0_SEL;
410
      IOMEM1_SEL_q <= IOMEM1_SEL;
411
    end if;
412
  end process;
413
 
414
  -- data RAM addresses
415
 
416
  DADR0_RAM <= get_dadr_ram(DADR0) when (XDMAE_i = '0') else
417
    get_dadr_ram(to_unsigned(XADR_i));
418
 
419
  DADR1_RAM <= get_dadr_ram(DADR1);
420
 
421
  -- data RAM write-enable
422
 
423
  DWE0_RAM <= DWE0 when (XDMAE_i = '0') else XWE_i;
424
 
425
  DDI_RAM <= DDATO when XDMAE_i = '0' else XDI_i;
426
 
427
  -- ASIP core data-in (pay attention not to read I/O memory in parallel!)
428
 
429
  DDATI0 <= sel_data(DDATI0_ROM,DDATI_IO_q,DDATI0_RAM,DROM0_SEL_q,IOMEM0_SEL_q);
430
  DDATI1 <= sel_data(DDATI1_ROM,DDATI_IO_q,DDATI1_RAM,DROM1_SEL_q,'0');
431
 
432
  -- data ROM address
433
 
434
  DADR0_ROM <= get_dadr_rom(DADR0);
435
  DADR1_ROM <= get_dadr_rom(DADR1);
436
 
437
  ---------------------------------------------------
438
  -- Instruction ROM
439
  ---------------------------------------------------
440
 
441
  -- instruction ROM is a single-port ROM with double
442
  -- word length (two instructions can be fetched with
443
  -- a single read)
444
 
445
  G_ROMI_1 : if (USE_ROM_MIF = '1') generate
446
 
447
  -- Data content for this ROM is assigned through a MIF file.
448
  -- This type of ROM is ok for synthesis with Altera tools.
449
 
450
  U_ROMI : G729A_ASIP_ROM_MIF
451
    generic map(
452
      WCOUNT => IMEM_SIZE/2,
453
      DATA_WIDTH => ILEN*2,
454
      ADDR_WIDTH => log2(IMEM_SIZE/2),
455
      ROM_INIT_FILE => "G729A_asip_romi.mif" --ROMI_INIT_FILE
456
    )
457
    port map(
458
      CLK_i => CLK_i,
459
      A_i => IADR(log2(IMEM_SIZE)-2 downto 0),
460
 
461
      Q_o => INSTR
462
    );
463
 
464
  end generate;
465
 
466
  G_ROMI_0 : if (USE_ROM_MIF = '0') generate
467
 
468
  -- Data content for this ROM is explicitly assigned in VHDL code.
469
  -- This type of ROM is ok for simulation and for synthesis with
470
  -- Xilinx tools.
471
 
472
  U_ROMI : G729A_ASIP_ROMI
473
    generic map(
474
      WCOUNT => IMEM_SIZE/2,
475
      DATA_WIDTH => ILEN*2,
476
      ADDR_WIDTH => log2(IMEM_SIZE/2)
477
    )
478
    port map(
479
      CLK_i => CLK_i,
480
      A_i => IADR(log2(IMEM_SIZE)-2 downto 0),
481
 
482
      Q_o => INSTR
483
    );
484
 
485
  end generate;
486
 
487
  ---------------------------------------------------
488
  -- Data ROM
489
  ---------------------------------------------------
490
 
491
  -- data ROM is a dual-port ROM with single word length
492
  -- (two reads can be performed in parallel).
493
 
494
  G_ROMD_1 : if (USE_ROM_MIF = '1') generate
495
 
496
  -- Data content for this ROM is assigned through a MIF file.
497
  -- This type of ROM is ok for synthesis with Altera tools.
498
 
499
  U_ROMD : G729A_ASIP_ROM_MIF_2R
500
    generic map(
501
      WCOUNT => CMEM_LIMIT,
502
      DATA_WIDTH => SDLEN,
503
      ADDR_WIDTH => log2(CMEM_LIMIT),
504
      ROM_INIT_FILE => "G729A_asip_romd.mif" --ROMD_INIT_FILE
505
    )
506
    port map(
507
      CLK_i => CLK_i,
508
      A0_i => DADR0_ROM,
509
      A1_i => DADR1_ROM,
510
 
511
      Q0_o => DDATI0_ROM,
512
      Q1_o => DDATI1_ROM
513
    );
514
 
515
  end generate;
516
 
517
  G_ROMD_0 : if (USE_ROM_MIF = '0') generate
518
 
519
  -- Data content for this ROM is explicitly assigned in VHDL code.
520
  -- This type of ROM is ok for simulation and for synthesis with
521
  -- Xilinx tools.
522
 
523
  U_ROMD : G729A_ASIP_ROMD
524
    generic map(
525
      WCOUNT => CMEM_LIMIT,
526
      DATA_WIDTH => SDLEN,
527
      ADDR_WIDTH => log2(CMEM_LIMIT)
528
    )
529
    port map(
530
      CLK_i => CLK_i,
531
      A0_i => DADR0_ROM,
532
      A1_i => DADR1_ROM,
533
 
534
      Q0_o => DDATI0_ROM,
535
      Q1_o => DDATI1_ROM
536
    );
537
 
538
  end generate;
539
 
540
  ---------------------------------------------------
541
  -- Data RAM
542
  ---------------------------------------------------
543
 
544
  -- data RAM is dual-port RAM with 1 read/write port and
545
  -- 1 read-only port (two reads, or one read and one write
546
  -- can be performed in parallel).
547
 
548
  U_RAMD : G729_ASIP_RAM_1RW1R
549
    generic map(
550
      DWIDTH => SDLEN,
551 3 madsilicon
      --WCOUNT => DMEM_SIZE-CMEM_LIMIT
552
      WCOUNT => 4096
553 2 madsilicon
    )
554
    port map(
555
      CLK_i => CLK_i,
556
      A_i => DADR0_RAM,
557
      DPRA_i => DADR1_RAM,
558
      D_i => DDI_RAM, --DDATO,
559
      WE_i => DWE0_RAM,
560
 
561
      Q_o => DDATI0_RAM,
562
      DPQ_o => DDATI1_RAM
563
    );
564
 
565
  XDO_o <= DDATI0_RAM(SDLEN-1 downto 0);
566
 
567
  ---------------------------------------------------
568
  -- Checker
569
  ---------------------------------------------------
570
 
571
  G_CHK0 : if(SIMULATION_ONLY = '1') generate
572
 
573
     assert not(IADR >= IMEM_SIZE and CLK_i = '1' and CLK_i'event)
574
     report "invalid instruction address!"
575
     severity ERROR;
576
 
577
     assert not(DADR0 >= DMEM_SIZE and DRE(0) = '1' and CLK_i = '1'
578
       and CLK_i'event)
579
     report "invalid read data address!"
580
     severity ERROR;
581
 
582
     assert not(DADR1 >= DMEM_SIZE and DRE(1) = '1' and CLK_i = '1'
583
       and CLK_i'event)
584
     report "invalid read data address!"
585
     severity ERROR;
586
 
587
     assert not(DADR0_RAM >= DMEM_SIZE and DWE0_RAM = '1' and CLK_i = '1' and CLK_i'event)
588
     report "invalid write data address!"
589
     severity ERROR;
590
 
591
     assert not(DWE0 = '1' and DADR0 > CMEM_LIMIT and CLK_i = '1'
592
       and CLK_i'event)
593
     report "Data ROM write attempt!"
594
     severity ERROR;
595
 
596
  end generate;
597
 
598
  ---------------------------------------------------
599
  -- I/O interface
600
  ---------------------------------------------------
601
 
602
  G2_T : if(IO_INTF_PRESENT = '1') generate
603
 
604
  U_IO : G729A_ASIP_IO_INTF
605
    generic map(
606
      MEM_LIMIT => MEM_LIMIT
607
    )
608
    port map(
609
      CLK_i => CLK_i,
610
      RST_i => RST_i,
611
      CPU_ADR_i => DADR0,
612
      CPU_RE_i => DRE(0),
613
      CPU_WE_i => DWE0,
614
      EXT_RE_i => DORE_i,
615
      EXT_WE_i => DIWE_i,
616
      CPU_DI_i => DDATO,
617
      EXT_DI_i => DI_i,
618
 
619
      DIV_o => DIV_o,
620
      DOV_o => DOV_o,
621
      CPU_DO_o => DDATI_IO,
622
      EXT_DO_o => DO_o
623
    );
624
 
625
  end generate;
626
 
627
  G2_F : if(IO_INTF_PRESENT = '0') generate
628
 
629
      DIV_o <= '0';
630
      DOV_o <= '0';
631
      DDATI_IO <= (others => '0');
632
      DO_o <= (others => '0');
633
 
634
  end generate;
635
 
636
  -- pipeline register (needed to match sync. RAM delay) 
637
  process(CLK_i)
638
  begin
639
    if(CLK_i = '1' and CLK_i'event) then
640
      DDATI_IO_q <= DDATI_IO;
641
    end if;
642
  end process;
643
 
644
end ARC;

powered by: WebSVN 2.1.0

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