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 2

Go to most recent revision | 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
    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
    return(DADR_RAM);
245
  end function;
246
 
247
  function get_dadr_rom(DADR : unsigned(ALEN-1 downto 0)) return unsigned is
248
    variable DADR_ROM : unsigned(12-1 downto 0);
249
  begin
250
    case DADR(12 downto 10) is
251
      when "100" => DADR_ROM(11 downto 10) := "01";
252
      when "101" => DADR_ROM(11 downto 10) := "10";
253
      when others => DADR_ROM(11 downto 10) := "00";
254
    end case;
255
    DADR_ROM(9 downto 0) := DADR(9 downto 0);
256
    return(DADR_ROM);
257
  end function;
258
 
259
  function sel_data(
260
    DI_ROM,DI_IO,DI_RAM : std_logic_vector(SDLEN-1 downto 0);
261
    ROM_SEL,IO_SEL : std_logic) return std_logic_vector is
262
  begin
263
    if(ROM_SEL = '1') then
264
      return(DI_ROM);
265
    elsif(IO_SEL = '1') then
266
      return(DI_IO);
267
    else
268
      return(DI_RAM);
269
    end if;
270
  end function;
271
 
272
  signal STRT_q : std_logic;
273
  signal SADR_q : unsigned(ALEN-1 downto 0);
274
  signal INSTR : std_logic_vector(ILEN*2-1 downto 0);
275
  signal DDATI0 : std_logic_vector(SDLEN-1 downto 0);
276
  signal DDATI1 : std_logic_vector(SDLEN-1 downto 0);
277
  signal BSY : std_logic;
278
  signal IADR : unsigned(ALEN-2 downto 0);
279
  signal DWE0 : std_logic;
280
  signal DRE : std_logic_vector(2-1 downto 0);
281
  signal DADR0 : unsigned(ALEN-1 downto 0);
282
  signal DADR1 : unsigned(ALEN-1 downto 0);
283
  signal DDATO : std_logic_vector(SDLEN-1 downto 0);
284
 
285
  signal DROM0_SEL,DROM1_SEL : std_logic;
286
  signal DROM0_SEL_q,DROM1_SEL_q : std_logic;
287
  signal DWE0_RAM : std_logic;
288
  signal DADR0_RAM : unsigned(log2(CMEM_LIMIT)-1 downto 0);
289
  signal DADR1_RAM : unsigned(log2(CMEM_LIMIT)-1 downto 0);
290
  signal DADR0_ROM : unsigned(log2(DMEM_SIZE-CMEM_LIMIT)-1 downto 0);
291
  signal DADR1_ROM : unsigned(log2(DMEM_SIZE-CMEM_LIMIT)-1 downto 0);
292
  signal DDATI0_RAM : std_logic_vector(SDLEN-1 downto 0);
293
  signal DDATI1_RAM : std_logic_vector(SDLEN-1 downto 0);
294
  signal DDATI0_ROM : std_logic_vector(SDLEN-1 downto 0);
295
  signal DDATI1_ROM : std_logic_vector(SDLEN-1 downto 0);
296
 
297
  signal IOMEM0_SEL,IOMEM1_SEL : std_logic;
298
  signal IOMEM0_SEL_q,IOMEM1_SEL_q : std_logic;
299
  signal DI_q,DO_q : std_logic_vector(SDLEN-1 downto 0);
300
  signal DIV_q,DOV_q : std_logic;
301
  signal DDATI_IO : std_logic_vector(SDLEN-1 downto 0);
302
  signal DDATI_IO_q : std_logic_vector(SDLEN-1 downto 0);
303
 
304
  signal DDI_RAM : std_logic_vector(SDLEN-1 downto 0);
305
 
306
begin
307
 
308
  ---------------------------------------------------
309
  -- ASIP Core
310
  ---------------------------------------------------
311
 
312
  process(CLK_i)
313
  begin
314
    if(CLK_i = '1' and CLK_i'event) then
315
      if(RST_i = '1') then
316
        STRT_q <= '0';
317
      else
318
        STRT_q <= STRT_i;
319
      end if;
320
      SADR_q <= to_unsigned(SADR_i);
321
    end if;
322
  end process;
323
 
324
  U_ASIP : G729A_ASIP_CPU_2W
325
    generic map(
326
      -- synthesis translate_off
327
      ST_FILENAME => ST_FILE,
328
      WB_FILENAME => WB_FILE,
329
      -- synthesis translate_on
330
      SIMULATION_ONLY => SIMULATION_ONLY
331
    )
332
    port map(
333
      CLK_i => CLK_i,
334
      RST_i => RST_i,
335
      STRT_i => STRT_q,
336
      SADR_i => SADR_q,
337
      INSTR_i => INSTR,
338
      DDAT0_i => DDATI0,
339
      DDAT1_i => DDATI1,
340
      CHK_ENB_i => CHK_ENB_i,
341
 
342
      BSY_o => BSY,
343
      IADR_o => IADR,
344
      DRE_o => DRE,
345
      DWE0_o => DWE0,
346
      DADR0_o => DADR0,
347
      DADR1_o => DADR1,
348
      DDAT0_o => DDATO
349
    );
350
 
351
  BSY_o <= BSY;
352
 
353
  ---------------------------------------------------
354
  -- Data memory selections signals
355
  ---------------------------------------------------
356
 
357
  G0_T : if(IO_INTF_PRESENT = '1') generate
358
 
359
  DROM0_SEL <= '1' when
360
    (DADR0 >= CMEM_LIMIT and DADR0 < IOMEM_LIMIT) else '0';
361
 
362
  DROM1_SEL <= '1' when
363
    (DADR1 >= CMEM_LIMIT and DADR1 < IOMEM_LIMIT) else '0';
364
 
365
  end generate;
366
 
367
  G0_F : if(IO_INTF_PRESENT = '0') generate
368
 
369
  DROM0_SEL <= '1' when
370
    (DADR0 >= CMEM_LIMIT) else '0';
371
 
372
  DROM1_SEL <= '1' when
373
    (DADR1 >= CMEM_LIMIT) else '0';
374
 
375
  end generate;
376
 
377
  -- registered DROM_SEL (needed to select ASIP data-in)
378
  process(CLK_i)
379
  begin
380
    if(CLK_i = '1' and CLK_i'event) then
381
      DROM0_SEL_q <= DROM0_SEL;
382
      DROM1_SEL_q <= DROM1_SEL;
383
    end if;
384
  end process;
385
 
386
  G1_T : if(IO_INTF_PRESENT = '1') generate
387
 
388
  IOMEM0_SEL <= '1' when (DADR0 >= IOMEM_LIMIT) else '0';
389
  IOMEM1_SEL <= '1' when (DADR1 >= IOMEM_LIMIT) else '0';
390
 
391
  end generate;
392
 
393
  G1_F : if(IO_INTF_PRESENT = '0') generate
394
 
395
  IOMEM0_SEL <= '0';
396
  IOMEM1_SEL <= '0';
397
 
398
  end generate;
399
 
400
  -- registered IOMEM_SEL (needed to select ASIP data-in)
401
  process(CLK_i)
402
  begin
403
    if(CLK_i = '1' and CLK_i'event) then
404
      IOMEM0_SEL_q <= IOMEM0_SEL;
405
      IOMEM1_SEL_q <= IOMEM1_SEL;
406
    end if;
407
  end process;
408
 
409
  -- data RAM addresses
410
 
411
  DADR0_RAM <= get_dadr_ram(DADR0) when (XDMAE_i = '0') else
412
    get_dadr_ram(to_unsigned(XADR_i));
413
 
414
  DADR1_RAM <= get_dadr_ram(DADR1);
415
 
416
  -- data RAM write-enable
417
 
418
  DWE0_RAM <= DWE0 when (XDMAE_i = '0') else XWE_i;
419
 
420
  DDI_RAM <= DDATO when XDMAE_i = '0' else XDI_i;
421
 
422
  -- ASIP core data-in (pay attention not to read I/O memory in parallel!)
423
 
424
  DDATI0 <= sel_data(DDATI0_ROM,DDATI_IO_q,DDATI0_RAM,DROM0_SEL_q,IOMEM0_SEL_q);
425
  DDATI1 <= sel_data(DDATI1_ROM,DDATI_IO_q,DDATI1_RAM,DROM1_SEL_q,'0');
426
 
427
  -- data ROM address
428
 
429
  DADR0_ROM <= get_dadr_rom(DADR0);
430
  DADR1_ROM <= get_dadr_rom(DADR1);
431
 
432
  ---------------------------------------------------
433
  -- Instruction ROM
434
  ---------------------------------------------------
435
 
436
  -- instruction ROM is a single-port ROM with double
437
  -- word length (two instructions can be fetched with
438
  -- a single read)
439
 
440
  G_ROMI_1 : if (USE_ROM_MIF = '1') generate
441
 
442
  -- Data content for this ROM is assigned through a MIF file.
443
  -- This type of ROM is ok for synthesis with Altera tools.
444
 
445
  U_ROMI : G729A_ASIP_ROM_MIF
446
    generic map(
447
      WCOUNT => IMEM_SIZE/2,
448
      DATA_WIDTH => ILEN*2,
449
      ADDR_WIDTH => log2(IMEM_SIZE/2),
450
      ROM_INIT_FILE => "G729A_asip_romi.mif" --ROMI_INIT_FILE
451
    )
452
    port map(
453
      CLK_i => CLK_i,
454
      A_i => IADR(log2(IMEM_SIZE)-2 downto 0),
455
 
456
      Q_o => INSTR
457
    );
458
 
459
  end generate;
460
 
461
  G_ROMI_0 : if (USE_ROM_MIF = '0') generate
462
 
463
  -- Data content for this ROM is explicitly assigned in VHDL code.
464
  -- This type of ROM is ok for simulation and for synthesis with
465
  -- Xilinx tools.
466
 
467
  U_ROMI : G729A_ASIP_ROMI
468
    generic map(
469
      WCOUNT => IMEM_SIZE/2,
470
      DATA_WIDTH => ILEN*2,
471
      ADDR_WIDTH => log2(IMEM_SIZE/2)
472
    )
473
    port map(
474
      CLK_i => CLK_i,
475
      A_i => IADR(log2(IMEM_SIZE)-2 downto 0),
476
 
477
      Q_o => INSTR
478
    );
479
 
480
  end generate;
481
 
482
  ---------------------------------------------------
483
  -- Data ROM
484
  ---------------------------------------------------
485
 
486
  -- data ROM is a dual-port ROM with single word length
487
  -- (two reads can be performed in parallel).
488
 
489
  G_ROMD_1 : if (USE_ROM_MIF = '1') generate
490
 
491
  -- Data content for this ROM is assigned through a MIF file.
492
  -- This type of ROM is ok for synthesis with Altera tools.
493
 
494
  U_ROMD : G729A_ASIP_ROM_MIF_2R
495
    generic map(
496
      WCOUNT => CMEM_LIMIT,
497
      DATA_WIDTH => SDLEN,
498
      ADDR_WIDTH => log2(CMEM_LIMIT),
499
      ROM_INIT_FILE => "G729A_asip_romd.mif" --ROMD_INIT_FILE
500
    )
501
    port map(
502
      CLK_i => CLK_i,
503
      A0_i => DADR0_ROM,
504
      A1_i => DADR1_ROM,
505
 
506
      Q0_o => DDATI0_ROM,
507
      Q1_o => DDATI1_ROM
508
    );
509
 
510
  end generate;
511
 
512
  G_ROMD_0 : if (USE_ROM_MIF = '0') generate
513
 
514
  -- Data content for this ROM is explicitly assigned in VHDL code.
515
  -- This type of ROM is ok for simulation and for synthesis with
516
  -- Xilinx tools.
517
 
518
  U_ROMD : G729A_ASIP_ROMD
519
    generic map(
520
      WCOUNT => CMEM_LIMIT,
521
      DATA_WIDTH => SDLEN,
522
      ADDR_WIDTH => log2(CMEM_LIMIT)
523
    )
524
    port map(
525
      CLK_i => CLK_i,
526
      A0_i => DADR0_ROM,
527
      A1_i => DADR1_ROM,
528
 
529
      Q0_o => DDATI0_ROM,
530
      Q1_o => DDATI1_ROM
531
    );
532
 
533
  end generate;
534
 
535
  ---------------------------------------------------
536
  -- Data RAM
537
  ---------------------------------------------------
538
 
539
  -- data RAM is dual-port RAM with 1 read/write port and
540
  -- 1 read-only port (two reads, or one read and one write
541
  -- can be performed in parallel).
542
 
543
  U_RAMD : G729_ASIP_RAM_1RW1R
544
    generic map(
545
      DWIDTH => SDLEN,
546
      WCOUNT => DMEM_SIZE-CMEM_LIMIT
547
    )
548
    port map(
549
      CLK_i => CLK_i,
550
      A_i => DADR0_RAM,
551
      DPRA_i => DADR1_RAM,
552
      D_i => DDI_RAM, --DDATO,
553
      WE_i => DWE0_RAM,
554
 
555
      Q_o => DDATI0_RAM,
556
      DPQ_o => DDATI1_RAM
557
    );
558
 
559
  XDO_o <= DDATI0_RAM(SDLEN-1 downto 0);
560
 
561
  ---------------------------------------------------
562
  -- Checker
563
  ---------------------------------------------------
564
 
565
  G_CHK0 : if(SIMULATION_ONLY = '1') generate
566
 
567
     assert not(IADR >= IMEM_SIZE and CLK_i = '1' and CLK_i'event)
568
     report "invalid instruction address!"
569
     severity ERROR;
570
 
571
     assert not(DADR0 >= DMEM_SIZE and DRE(0) = '1' and CLK_i = '1'
572
       and CLK_i'event)
573
     report "invalid read data address!"
574
     severity ERROR;
575
 
576
     assert not(DADR1 >= DMEM_SIZE and DRE(1) = '1' and CLK_i = '1'
577
       and CLK_i'event)
578
     report "invalid read data address!"
579
     severity ERROR;
580
 
581
     assert not(DADR0_RAM >= DMEM_SIZE and DWE0_RAM = '1' and CLK_i = '1' and CLK_i'event)
582
     report "invalid write data address!"
583
     severity ERROR;
584
 
585
     assert not(DWE0 = '1' and DADR0 > CMEM_LIMIT and CLK_i = '1'
586
       and CLK_i'event)
587
     report "Data ROM write attempt!"
588
     severity ERROR;
589
 
590
  end generate;
591
 
592
  ---------------------------------------------------
593
  -- I/O interface
594
  ---------------------------------------------------
595
 
596
  G2_T : if(IO_INTF_PRESENT = '1') generate
597
 
598
  U_IO : G729A_ASIP_IO_INTF
599
    generic map(
600
      MEM_LIMIT => MEM_LIMIT
601
    )
602
    port map(
603
      CLK_i => CLK_i,
604
      RST_i => RST_i,
605
      CPU_ADR_i => DADR0,
606
      CPU_RE_i => DRE(0),
607
      CPU_WE_i => DWE0,
608
      EXT_RE_i => DORE_i,
609
      EXT_WE_i => DIWE_i,
610
      CPU_DI_i => DDATO,
611
      EXT_DI_i => DI_i,
612
 
613
      DIV_o => DIV_o,
614
      DOV_o => DOV_o,
615
      CPU_DO_o => DDATI_IO,
616
      EXT_DO_o => DO_o
617
    );
618
 
619
  end generate;
620
 
621
  G2_F : if(IO_INTF_PRESENT = '0') generate
622
 
623
      DIV_o <= '0';
624
      DOV_o <= '0';
625
      DDATI_IO <= (others => '0');
626
      DO_o <= (others => '0');
627
 
628
  end generate;
629
 
630
  -- pipeline register (needed to match sync. RAM delay) 
631
  process(CLK_i)
632
  begin
633
    if(CLK_i = '1' and CLK_i'event) then
634
      DDATI_IO_q <= DDATI_IO;
635
    end if;
636
  end process;
637
 
638
end ARC;

powered by: WebSVN 2.1.0

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