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

Subversion Repositories mips_enhanced

[/] [mips_enhanced/] [trunk/] [grlib-gpl-1.0.19-b3188/] [lib/] [tech/] [axcelerator/] [components/] [axcelerator_small.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimamali
------------------------------------------------------------------------------
2
--  This file is a part of the GRLIB VHDL IP LIBRARY
3
--  Copyright (C) 2003, Gaisler Research
4
--
5
--  This program is free software; you can redistribute it and/or modify
6
--  it under the terms of the GNU General Public License as published by
7
--  the Free Software Foundation; either version 2 of the License, or
8
--  (at your option) any later version.
9
--
10
--  This program is distributed in the hope that it will be useful,
11
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
--  GNU General Public License for more details.
14
--
15
--  You should have received a copy of the GNU General Public License
16
--  along with this program; if not, write to the Free Software
17
--  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
18
 
19
-- pragma translate_on
20
 
21
library ieee;
22
use ieee.std_logic_1164.all;
23
use ieee.numeric_std.all;
24
 
25
entity RAM64K36 is port(
26
        DEPTH3, DEPTH2, DEPTH1, DEPTH0,
27
        WRAD15, WRAD14, WRAD13, WRAD12, WRAD11, WRAD10, WRAD9 ,
28
        WRAD8 , WRAD7 , WRAD6 , WRAD5 , WRAD4 , WRAD3 , WRAD2 ,
29
        WRAD1 , WRAD0 , WD35  , WD34  , WD33  , WD32  , WD31  ,
30
        WD30  , WD29  , WD28  , WD27  , WD26  , WD25  , WD24  ,
31
        WD23  , WD22  , WD21  , WD20  , WD19  , WD18  , WD17  ,
32
        WD16  , WD15  , WD14  , WD13  , WD12  , WD11  , WD10  ,
33
        WD9   , WD8   , WD7   , WD6   , WD5   , WD4   , WD3   ,
34
        WD2   , WD1   , WD0   , WW2   , WW1   , WW0   , WEN   ,
35
        WCLK  , RDAD15, RDAD14, RDAD13, RDAD12, RDAD11, RDAD10,
36
        RDAD9 , RDAD8 , RDAD7 , RDAD6 , RDAD5 , RDAD4 , RDAD3 ,
37
        RDAD2 , RDAD1 , RDAD0 , RW2   , RW1   , RW0   , REN   ,
38
        RCLK   : in  std_ulogic ;
39
        RD35  , RD34  , RD33  , RD32  , RD31  , RD30  , RD29  ,
40
        RD28  , RD27  , RD26  , RD25  , RD24  , RD23  , RD22  ,
41
        RD21  , RD20  , RD19  , RD18  , RD17  , RD16  , RD15  ,
42
        RD14  , RD13  , RD12  , RD11  , RD10  , RD9   , RD8   ,
43
        RD7   , RD6   , RD5   , RD4   , RD3   , RD2   , RD1   ,
44
        RD0    : out std_ulogic);
45
end;
46
 
47
architecture rtl of RAM64K36 is
48
  signal re : std_ulogic;
49
begin
50
 
51
  rp : process(RCLK, WCLK)
52
  constant words : integer := 2**16;
53
  subtype word is std_logic_vector(35 downto 0);
54
  type dregtype is array (0 to words - 1) of word;
55
  variable rfd : dregtype;
56
  variable wa, ra : std_logic_vector(15 downto 0);
57
  variable q : std_logic_vector(35 downto 0);
58
  begin
59
    if rising_edge(RCLK) then
60
      ra := RDAD15 & RDAD14 & RDAD13 & RDAD12 & RDAD11 & RDAD10 & RDAD9 &
61
            RDAD8 & RDAD7 & RDAD6 & RDAD5 & RDAD4 & RDAD3 & RDAD2 & RDAD1 & RDAD0;
62
      if not (is_x (ra)) and REN = '1' then
63
        q := rfd(to_integer(unsigned(ra)) mod words);
64
      else q := (others => 'X'); end if;
65
    end if;
66
    if rising_edge(WCLK) and (wen = '1') then
67
      wa := WRAD15 & WRAD14 & WRAD13 & WRAD12 & WRAD11 & WRAD10 & WRAD9 &
68
            WRAD8 & WRAD7 & WRAD6 & WRAD5 & WRAD4 & WRAD3 & WRAD2 & WRAD1 & WRAD0;
69
      if not is_x (wa) then
70
        rfd(to_integer(unsigned(wa)) mod words) :=
71
          WD35 & WD34 & WD33 & WD32 & WD31 & WD30 & WD29 & WD28 & WD27 &
72
          WD26 & WD25 & WD24 & WD23 & WD22 & WD21 & WD20 & WD19 & WD18 &
73
          WD17 & WD16 & WD15 & WD14 & WD13 & WD12 & WD11 & WD10 & WD9 &
74
          WD8 & WD7 & WD6 & WD5 & WD4 & WD3 & WD2 & WD1 & WD0;
75
      end if;
76
      if ra = wa then q := (others => 'X'); end if;  -- no write-through
77
    end if;
78
    RD35 <= q(35); RD34 <= q(34); RD33 <= q(33); RD32 <= q(32); RD31 <= q(31);
79
    RD30 <= q(30); RD29 <= q(29); RD28 <= q(28); RD27 <= q(27); RD26 <= q(26);
80
    RD25 <= q(25); RD24 <= q(24); RD23 <= q(23); RD22 <= q(22); RD21 <= q(21);
81
    RD20 <= q(20); RD19 <= q(19); RD18 <= q(18); RD17 <= q(17); RD16 <= q(16);
82
    RD15 <= q(15); RD14 <= q(14); RD13 <= q(13); RD12 <= q(12); RD11 <= q(11);
83
    RD10 <= q(10); RD9 <= q(9); RD8 <= q(8); RD7 <= q(7); RD6 <= q(6);
84
    RD5 <= q(5); RD4 <= q(4); RD3 <= q(3); RD2 <= q(2); RD1 <= q(1);
85
    RD0 <= q(0);
86
  end process;
87
end;
88
 
89
-- PCI PADS ----------------------------------------------------
90
 
91
library ieee;
92
use ieee.std_logic_1164.all;
93
entity hclkbuf_pci is port( pad : in  std_logic; y   : out std_logic); end;
94
architecture struct of hclkbuf_pci is begin y <= to_X01(pad); end;
95
 
96
library ieee;
97
use ieee.std_logic_1164.all;
98
entity clkbuf_pci is port( pad : in  std_logic; y   : out std_logic); end;
99
architecture struct of clkbuf_pci is begin y <= to_X01(pad); end;
100
 
101
library ieee;
102
use ieee.std_logic_1164.all;
103
entity inbuf_pci is port( pad : in  std_logic; y   : out std_logic); end;
104
architecture struct of inbuf_pci is begin y <= to_X01(pad) after 2 ns; end;
105
 
106
library ieee;
107
use ieee.std_logic_1164.all;
108
entity bibuf_pci is port
109
  (d, e : in  std_logic; pad : inout std_logic; y : out std_logic);
110
end;
111
architecture struct of bibuf_pci is begin
112
  y <= to_X01(pad) after 2 ns;
113
  pad <= d after 5 ns when to_X01(e) = '1' else
114
         'Z' after 5 ns when to_X01(e) = '0' else 'X' after 5 ns;
115
end;
116
 
117
library ieee;
118
use ieee.std_logic_1164.all;
119
entity tribuff_pci is port (d, e : in  std_logic; pad : out std_logic ); end;
120
architecture struct of tribuff_pci is begin
121
  pad <= d after 5 ns when to_X01(e) = '1' else
122
         'Z' after 5 ns when to_X01(e) = '0' else 'X' after 5 ns;
123
end;
124
 
125
library ieee;
126
use ieee.std_logic_1164.all;
127
entity outbuf_pci is port (d : in  std_logic; pad : out std_logic ); end;
128
architecture struct of outbuf_pci is begin pad <= d after 5 ns; end;
129
 
130
-- STANDARD PADS ----------------------------------------------------
131
 
132
library ieee;
133
use ieee.std_logic_1164.all;
134
entity clkbuf is port( pad : in  std_logic; y   : out std_logic); end;
135
architecture struct of clkbuf is begin y <= to_X01(pad); end;
136
 
137
library ieee;
138
use ieee.std_logic_1164.all;
139
entity hclkbuf is port( pad : in  std_logic; y   : out std_logic); end;
140
architecture struct of hclkbuf is begin y <= to_X01(pad); end;
141
 
142
library ieee;
143
use ieee.std_logic_1164.all;
144
entity inbuf is port( pad : in  std_logic; y   : out std_logic); end;
145
architecture struct of inbuf is begin y <= to_X01(pad) after 1 ns; end;
146
 
147
library ieee;
148
use ieee.std_logic_1164.all;
149
entity bibuf is port
150
  (d, e : in  std_logic; pad : inout std_logic; y : out std_logic);
151
end;
152
architecture struct of bibuf is begin
153
  y <= to_X01(pad) after 2 ns;
154
  pad <= d after 2 ns when to_X01(e) = '1' else
155
         'Z' after 2 ns when to_X01(e) = '0' else 'X' after 2 ns;
156
end;
157
 
158
library ieee;
159
use ieee.std_logic_1164.all;
160
entity tribuff is port (d, e : in  std_logic; pad : out std_logic ); end;
161
architecture struct of tribuff is begin
162
  pad <= d after 2 ns when to_X01(e) = '1' else
163
         'Z' after 2 ns when to_X01(e) = '0' else 'X' after 2 ns;
164
end;
165
 
166
library ieee;
167
use ieee.std_logic_1164.all;
168
entity outbuf is port (d : in  std_logic; pad : out std_logic ); end;
169
architecture struct of outbuf is begin pad <= d after 2 ns; end;
170
 
171
library ieee;
172
use ieee.std_logic_1164.all;
173
entity outbuf_f_8 is port (d : in  std_logic; pad : out std_logic ); end;
174
architecture struct of outbuf_f_8 is begin pad <= d after 2 ns; end;
175
 
176
library ieee;
177
use ieee.std_logic_1164.all;
178
entity outbuf_f_12 is port (d : in  std_logic; pad : out std_logic ); end;
179
architecture struct of outbuf_f_12 is begin pad <= d after 2 ns; end;
180
 
181
library ieee;
182
use ieee.std_logic_1164.all;
183
entity outbuf_f_16 is port (d : in  std_logic; pad : out std_logic ); end;
184
architecture struct of outbuf_f_16 is begin pad <= d after 2 ns; end;
185
 
186
library ieee;
187
use ieee.std_logic_1164.all;
188
entity outbuf_f_24 is port (d : in  std_logic; pad : out std_logic ); end;
189
architecture struct of outbuf_f_24 is begin pad <= d after 2 ns; end;
190
 
191
library ieee;
192
use ieee.std_logic_1164.all;
193
entity inbuf_lvds is port( y : out std_logic; padp, padn : in  std_logic); end;
194
architecture struct of inbuf_lvds is
195
signal yn : std_ulogic := '0';
196
begin
197
  yn <= to_X01(padp) after 1 ns when to_x01(padp xor padn) = '1' else yn after 1 ns;
198
  y <= yn;
199
end;
200
 
201
library ieee;
202
use ieee.std_logic_1164.all;
203
entity outbuf_lvds is port (d : in  std_logic; padp, padn : out std_logic ); end;
204
architecture struct of outbuf_lvds is begin
205
  padp <= d after 1 ns;
206
  padn <= not d after 1 ns;
207
end;
208
 
209
-- clock buffers ----------------------
210
 
211
library ieee;
212
use ieee.std_logic_1164.all;
213
entity hclkint is port( a : in  std_logic; y   : out std_logic); end;
214
architecture struct of hclkint is begin y <= to_X01(a); end;
215
 
216
library ieee;
217
use ieee.std_logic_1164.all;
218
entity clkint is port( a : in  std_logic; y   : out std_logic); end;
219
architecture struct of clkint is begin y <= to_X01(a); end;
220
 
221
library ieee;
222
use ieee.std_logic_1164.all;
223
entity add1 is
224
   port(
225
   a : in std_logic;
226
   b : in std_logic;
227
   fci : in std_logic;
228
   s : out std_logic;
229
   fco : out std_logic);
230
end add1;
231
architecture beh of add1 is
232
   signal un1_fco : std_logic;
233
   signal un2_fco : std_logic;
234
   signal un3_fco : std_logic;
235
begin
236
   s <= a xor b xor fci;
237
   un1_fco <= a and b;
238
   un2_fco <= a and fci;
239
   un3_fco <= b and fci;
240
   fco <= un1_fco or un2_fco or un3_fco;
241
end beh;
242
 
243
 
244
library ieee;
245
use ieee.std_logic_1164.all;
246
entity and2 is
247
   port(
248
   a : in std_logic;
249
   b : in std_logic;
250
   y : out std_logic);
251
end and2;
252
architecture beh of and2 is
253
begin
254
   y <= b and a;
255
end beh;
256
 
257
 
258
library ieee;
259
use ieee.std_logic_1164.all;
260
entity and2a is
261
   port(
262
   a : in std_logic;
263
   b : in std_logic;
264
   y : out std_logic);
265
end and2a;
266
architecture beh of and2a is
267
   signal ai : std_logic;
268
begin
269
   ai <= not a;
270
   y <= b and ai;
271
end beh;
272
 
273
 
274
library ieee;
275
use ieee.std_logic_1164.all;
276
entity and2b is
277
   port(
278
   a : in std_logic;
279
   b : in std_logic;
280
   y : out std_logic);
281
end and2b;
282
architecture beh of and2b is
283
   signal ai : std_logic;
284
   signal bi : std_logic;
285
begin
286
   ai <= not a;
287
   bi <= not b;
288
   y <= bi and ai;
289
end beh;
290
 
291
 
292
library ieee;
293
use ieee.std_logic_1164.all;
294
entity and3 is
295
   port(
296
   a : in std_logic;
297
   b : in std_logic;
298
   c : in std_logic;
299
   y : out std_logic);
300
end and3;
301
architecture beh of and3 is
302
begin
303
   y <= c and b and a;
304
end beh;
305
 
306
 
307
library ieee;
308
use ieee.std_logic_1164.all;
309
entity and3a is
310
   port(
311
   a : in std_logic;
312
   b : in std_logic;
313
   c : in std_logic;
314
   y : out std_logic);
315
end and3a;
316
architecture beh of and3a is
317
   signal ai : std_logic;
318
begin
319
   ai <= not a;
320
   y <= c and b and ai;
321
end beh;
322
 
323
 
324
library ieee;
325
use ieee.std_logic_1164.all;
326
entity and3b is
327
   port(
328
   a : in std_logic;
329
   b : in std_logic;
330
   c : in std_logic;
331
   y : out std_logic);
332
end and3b;
333
architecture beh of and3b is
334
   signal ai : std_logic;
335
   signal bi : std_logic;
336
begin
337
   ai <= not a;
338
   bi <= not b;
339
   y <= c and bi and ai;
340
end beh;
341
 
342
 
343
library ieee;
344
use ieee.std_logic_1164.all;
345
entity and3c is
346
   port(
347
   a : in std_logic;
348
   b : in std_logic;
349
   c : in std_logic;
350
   y : out std_logic);
351
end and3c;
352
architecture beh of and3c is
353
   signal ai : std_logic;
354
   signal bi : std_logic;
355
   signal ci : std_logic;
356
begin
357
   ai <= not a;
358
   bi <= not b;
359
   ci <= not c;
360
   y <= ci and bi and ai;
361
end beh;
362
 
363
 
364
library ieee;
365
use ieee.std_logic_1164.all;
366
entity and4 is
367
   port(
368
   a : in std_logic;
369
   b : in std_logic;
370
   c : in std_logic;
371
   d : in std_logic;
372
   y : out std_logic);
373
end and4;
374
architecture beh of and4 is
375
begin
376
   y <= d and c and b and a;
377
end beh;
378
 
379
 
380
library ieee;
381
use ieee.std_logic_1164.all;
382
entity and4a is
383
   port(
384
   a : in std_logic;
385
   b : in std_logic;
386
   c : in std_logic;
387
   d : in std_logic;
388
   y : out std_logic);
389
end and4a;
390
architecture beh of and4a is
391
   signal ai : std_logic;
392
begin
393
   ai <= not a;
394
   y <= d and c and b and ai;
395
end beh;
396
 
397
 
398
library ieee;
399
use ieee.std_logic_1164.all;
400
entity and4b is
401
   port(
402
   a : in std_logic;
403
   b : in std_logic;
404
   c : in std_logic;
405
   d : in std_logic;
406
   y : out std_logic);
407
end and4b;
408
architecture beh of and4b is
409
   signal ai : std_logic;
410
   signal bi : std_logic;
411
begin
412
   ai <= not a;
413
   bi <= not b;
414
   y <= d and c and bi and ai;
415
end beh;
416
 
417
 
418
library ieee;
419
use ieee.std_logic_1164.all;
420
entity and4c is
421
   port(
422
   a : in std_logic;
423
   b : in std_logic;
424
   c : in std_logic;
425
   d : in std_logic;
426
   y : out std_logic);
427
end and4c;
428
architecture beh of and4c is
429
   signal ai : std_logic;
430
   signal bi : std_logic;
431
   signal ci : std_logic;
432
begin
433
   ai <= not a;
434
   bi <= not b;
435
   ci <= not c;
436
   y <= d and ci and bi and ai;
437
end beh;
438
 
439
 
440
library ieee;
441
use ieee.std_logic_1164.all;
442
entity buff is
443
   port(
444
   a : in std_logic;
445
   y : out std_logic);
446
end buff;
447
architecture beh of buff is
448
begin
449
   y <= a;
450
end beh;
451
 
452
library ieee;
453
use ieee.std_logic_1164.all;
454
entity cm8 is
455
   port(
456
   d0 : in std_logic;
457
   d1 : in std_logic;
458
   d2 : in std_logic;
459
   d3 : in std_logic;
460
   s00 : in std_logic;
461
   s01 : in std_logic;
462
   s10 : in std_logic;
463
   s11 : in std_logic;
464
   y : out std_logic);
465
end cm8;
466
architecture beh of cm8 is
467
   signal s0 : std_logic;
468
   signal s1 : std_logic;
469
   signal m0 : std_logic;
470
   signal m1 : std_logic;
471
begin
472
   s0 <= s01 and s00;
473
   s1 <= s11 or s10;
474
   m0 <= d0 when s0 = '0' else d1;
475
   m1 <= d2 when s0 = '0' else d3;
476
   y <= m0 when s1 = '0' else m1;
477
end beh;
478
 
479
 
480
library ieee;
481
use ieee.std_logic_1164.all;
482
entity cm8inv is
483
   port(
484
   a : in std_logic;
485
   y : out std_logic);
486
end cm8inv;
487
architecture beh of cm8inv is
488
begin
489
   y <= not a;
490
end beh;
491
 
492
 
493
library ieee;
494
use ieee.std_logic_1164.all;
495
entity df1 is
496
   port(
497
   d : in std_logic;
498
   clk : in std_logic;
499
   q : out std_logic);
500
end df1;
501
architecture beh of df1 is
502
begin
503
    ff : process (clk)
504
    begin
505
      if rising_edge(clk) then
506
         q <= d;
507
      end if;
508
    end process ff;
509
end beh;
510
 
511
 
512
library ieee;
513
use ieee.std_logic_1164.all;
514
entity dfc1b is
515
   port(
516
   d : in std_logic;
517
   clk : in std_logic;
518
   clr : in std_logic;
519
   q : out std_logic);
520
end dfc1b;
521
architecture beh of dfc1b is
522
begin
523
   ff : process (clk, clr)
524
   begin
525
     if clr = '0' then
526
        q <= '0';
527
     elsif rising_edge(clk) then
528
        q <= d;
529
     end if;
530
   end process ff;
531
end beh;
532
 
533
library ieee;
534
use ieee.std_logic_1164.all;
535
entity dfc1c is
536
   port(
537
   d : in std_logic;
538
   clk : in std_logic;
539
   clr : in std_logic;
540
   q : out std_logic);
541
end dfc1c;
542
architecture beh of dfc1c is
543
begin
544
   ff : process (clk, clr)
545
   begin
546
     if clr = '1' then
547
        q <= '1';
548
     elsif rising_edge(clk) then
549
        q <= not d;
550
     end if;
551
   end process ff;
552
end beh;
553
 
554
library ieee;
555
use ieee.std_logic_1164.all;
556
entity dfc1d is
557
   port(
558
   d : in std_logic;
559
   clk : in std_logic;
560
   clr : in std_logic;
561
   q : out std_logic);
562
end dfc1d;
563
architecture beh of dfc1d is
564
begin
565
   ff : process (clk, clr)
566
   begin
567
     if clr = '0' then
568
        q <= '0';
569
     elsif falling_edge(clk) then
570
        q <= d;
571
     end if;
572
   end process ff;
573
end beh;
574
 
575
library ieee;
576
use ieee.std_logic_1164.all;
577
entity dfe1b is
578
   port(
579
   d : in std_logic;
580
   e : in std_logic;
581
   clk : in std_logic;
582
   q : out std_logic);
583
end dfe1b;
584
architecture beh of dfe1b is
585
   signal q_int_1 : std_logic;
586
   signal nq : std_logic;
587
begin
588
   nq <= d when e = '0' else q_int_1;
589
   q <= q_int_1;
590
   ff : process (clk)
591
   begin
592
     if rising_edge(clk) then
593
        q_int_1 <= nq;
594
     end if;
595
   end process ff;
596
end beh;
597
 
598
 
599
library ieee;
600
use ieee.std_logic_1164.all;
601
entity dfe3c is
602
   port(
603
   d : in std_logic;
604
   e : in std_logic;
605
   clk : in std_logic;
606
   clr : in std_logic;
607
   q : out std_logic);
608
end dfe3c;
609
architecture beh of dfe3c is
610
   signal q_int_0 : std_logic;
611
   signal md : std_logic;
612
begin
613
   md <= d when e = '0' else q_int_0;
614
   q <= q_int_0;
615
   ff : process (clk, clr)
616
   begin
617
     if clr = '0' then
618
        q_int_0 <= '0';
619
     elsif rising_edge(clk) then
620
        q_int_0 <= md;
621
     end if;
622
   end process ff;
623
end beh;
624
 
625
 
626
library ieee;
627
use ieee.std_logic_1164.all;
628
entity dfe4f is
629
   port(
630
   d : in std_logic;
631
   e : in std_logic;
632
   clk : in std_logic;
633
   pre : in std_logic;
634
   q : out std_logic);
635
end dfe4f;
636
architecture beh of dfe4f is
637
   signal q_int_1 : std_logic;
638
   signal un1 : std_logic;
639
begin
640
   un1 <= d when e = '0' else q_int_1;
641
   q <= q_int_1;
642
   ff : process (clk, pre)
643
   begin
644
     if pre = '0' then
645
        q_int_1 <= '1';
646
     elsif rising_edge(clk) then
647
        q_int_1 <= un1;
648
     end if;
649
   end process ff;
650
end beh;
651
 
652
 
653
library ieee;
654
use ieee.std_logic_1164.all;
655
entity dfp1 is
656
   port(
657
   d : in std_logic;
658
   clk : in std_logic;
659
   pre : in std_logic;
660
   q : out std_logic);
661
end dfp1;
662
architecture beh of dfp1 is
663
begin
664
   ff : process (clk, pre)
665
   begin
666
     if pre = '1' then
667
        q <= '1';
668
     elsif rising_edge(clk) then
669
        q <= d;
670
     end if;
671
   end process ff;
672
end beh;
673
 
674
 
675
library ieee;
676
use ieee.std_logic_1164.all;
677
entity dfp1b is
678
   port(
679
   d : in std_logic;
680
   clk : in std_logic;
681
   pre : in std_logic;
682
   q : out std_logic);
683
end dfp1b;
684
architecture beh of dfp1b is
685
begin
686
   ff : process (clk, pre)
687
   begin
688
     if pre = '0' then
689
        q <= '1';
690
     elsif rising_edge(clk) then
691
        q <= d;
692
     end if;
693
   end process ff;
694
end beh;
695
 
696
 
697
library ieee;
698
use ieee.std_logic_1164.all;
699
entity dfp1d is
700
   port(
701
   d : in std_logic;
702
   clk : in std_logic;
703
   pre : in std_logic;
704
   q : out std_logic);
705
end dfp1d;
706
architecture beh of dfp1d is
707
begin
708
   ff : process (clk, pre)
709
   begin
710
     if pre = '0' then
711
        q <= '1';
712
     elsif falling_edge(clk) then
713
        q <= d;
714
     end if;
715
   end process ff;
716
end beh;
717
 
718
 
719
library ieee;
720
use ieee.std_logic_1164.all;
721
entity gnd is
722
   port(
723
   y : out std_logic);
724
end gnd;
725
architecture beh of gnd is
726
begin
727
   y <= '0';
728
end beh;
729
 
730
library ieee;
731
use ieee.std_logic_1164.all;
732
entity dfm is
733
   port(
734
      clk : in std_logic;
735
      s : in std_logic;
736
      a : in std_logic;
737
      b : in std_logic;
738
      q : out std_logic);
739
end dfm;
740
architecture beh of dfm is
741
begin
742
   ff : process (clk)
743
   begin
744
     if rising_edge(clk) then
745
        if s = '0' then q <= a;
746
        else q <= b; end if;
747
     end if;
748
   end process ff;
749
end beh;
750
 
751
--
752
--library ieee;
753
--use ieee.std_logic_1164.all;
754
--entity hclkbuf is
755
--   port(
756
--   pad : in std_logic;
757
--   y : out std_logic);
758
--end hclkbuf;
759
--architecture beh of hclkbuf is
760
--begin
761
--   y <= pad;
762
--end beh;
763
--
764
--
765
--library ieee;
766
--use ieee.std_logic_1164.all;
767
--entity inbuf is
768
--   port(
769
--   pad : in std_logic;
770
--   y : out std_logic);
771
--end inbuf;
772
--architecture beh of inbuf is
773
--begin
774
--   y <= pad;
775
--end beh;
776
 
777
 
778
library ieee;
779
use ieee.std_logic_1164.all;
780
entity inv is
781
   port(
782
   a : in std_logic;
783
   y : out std_logic);
784
end inv;
785
architecture beh of inv is
786
begin
787
   y <= not a;
788
end beh;
789
 
790
 
791
library ieee;
792
use ieee.std_logic_1164.all;
793
entity nand4 is
794
   port(
795
   a : in std_logic;
796
   b : in std_logic;
797
   c : in std_logic;
798
   d : in std_logic;
799
   y : out std_logic);
800
end nand4;
801
architecture beh of nand4 is
802
   signal yx : std_logic;
803
begin
804
   yx <= d and c and b and a;
805
   y <= not yx;
806
end beh;
807
 
808
 
809
library ieee;
810
use ieee.std_logic_1164.all;
811
entity or2 is
812
   port(
813
   a : in std_logic;
814
   b : in std_logic;
815
   y : out std_logic);
816
end or2;
817
architecture beh of or2 is
818
begin
819
   y <= b or a;
820
end beh;
821
 
822
 
823
library ieee;
824
use ieee.std_logic_1164.all;
825
entity or2a is
826
   port(
827
   a : in std_logic;
828
   b : in std_logic;
829
   y : out std_logic);
830
end or2a;
831
architecture beh of or2a is
832
   signal ai : std_logic;
833
begin
834
   ai <= not a;
835
   y <= b or ai;
836
end beh;
837
 
838
 
839
library ieee;
840
use ieee.std_logic_1164.all;
841
entity or2b is
842
   port(
843
   a : in std_logic;
844
   b : in std_logic;
845
   y : out std_logic);
846
end or2b;
847
architecture beh of or2b is
848
   signal ai : std_logic;
849
   signal bi : std_logic;
850
begin
851
   ai <= not a;
852
   bi <= not b;
853
   y <= bi or ai;
854
end beh;
855
 
856
 
857
library ieee;
858
use ieee.std_logic_1164.all;
859
entity or3 is
860
   port(
861
   a : in std_logic;
862
   b : in std_logic;
863
   c : in std_logic;
864
   y : out std_logic);
865
end or3;
866
architecture beh of or3 is
867
begin
868
   y <= c or b or a;
869
end beh;
870
 
871
 
872
library ieee;
873
use ieee.std_logic_1164.all;
874
entity or3a is
875
   port(
876
   a : in std_logic;
877
   b : in std_logic;
878
   c : in std_logic;
879
   y : out std_logic);
880
end or3a;
881
architecture beh of or3a is
882
   signal ai : std_logic;
883
begin
884
   ai <= not a;
885
   y <= c or b or ai;
886
end beh;
887
 
888
 
889
library ieee;
890
use ieee.std_logic_1164.all;
891
entity or3b is
892
   port(
893
   a : in std_logic;
894
   b : in std_logic;
895
   c : in std_logic;
896
   y : out std_logic);
897
end or3b;
898
architecture beh of or3b is
899
   signal ai : std_logic;
900
   signal bi : std_logic;
901
begin
902
   ai <= not a;
903
   bi <= not b;
904
   y <= c or bi or ai;
905
end beh;
906
 
907
 
908
library ieee;
909
use ieee.std_logic_1164.all;
910
entity or3c is
911
   port(
912
   a : in std_logic;
913
   b : in std_logic;
914
   c : in std_logic;
915
   y : out std_logic);
916
end or3c;
917
architecture beh of or3c is
918
   signal ai : std_logic;
919
   signal bi : std_logic;
920
   signal ci : std_logic;
921
begin
922
   ai <= not a;
923
   bi <= not b;
924
   ci <= not c;
925
   y <= ci or bi or ai;
926
end beh;
927
 
928
 
929
library ieee;
930
use ieee.std_logic_1164.all;
931
entity or4 is
932
   port(
933
   a : in std_logic;
934
   b : in std_logic;
935
   c : in std_logic;
936
   d : in std_logic;
937
   y : out std_logic);
938
end or4;
939
architecture beh of or4 is
940
begin
941
   y <= d or c or b or a;
942
end beh;
943
 
944
 
945
library ieee;
946
use ieee.std_logic_1164.all;
947
entity or4a is
948
   port(
949
   a : in std_logic;
950
   b : in std_logic;
951
   c : in std_logic;
952
   d : in std_logic;
953
   y : out std_logic);
954
end or4a;
955
architecture beh of or4a is
956
   signal ai : std_logic;
957
begin
958
   ai <= not a;
959
   y <= d or c or b or ai;
960
end beh;
961
 
962
 
963
library ieee;
964
use ieee.std_logic_1164.all;
965
entity or4b is
966
   port(
967
   a : in std_logic;
968
   b : in std_logic;
969
   c : in std_logic;
970
   d : in std_logic;
971
   y : out std_logic);
972
end or4b;
973
architecture beh of or4b is
974
   signal ai : std_logic;
975
   signal bi : std_logic;
976
begin
977
   ai <= not a;
978
   bi <= not b;
979
   y <= d or c or bi or ai;
980
end beh;
981
 
982
 
983
library ieee;
984
use ieee.std_logic_1164.all;
985
entity or4c is
986
   port(
987
   a : in std_logic;
988
   b : in std_logic;
989
   c : in std_logic;
990
   d : in std_logic;
991
   y : out std_logic);
992
end or4c;
993
architecture beh of or4c is
994
   signal ai : std_logic;
995
   signal bi : std_logic;
996
   signal ci : std_logic;
997
begin
998
   ai <= not a;
999
   bi <= not b;
1000
   ci <= not c;
1001
   y <= d or ci or bi or ai;
1002
end beh;
1003
 
1004
 
1005
library ieee;
1006
use ieee.std_logic_1164.all;
1007
entity or4d is
1008
   port(
1009
   a : in std_logic;
1010
   b : in std_logic;
1011
   c : in std_logic;
1012
   d : in std_logic;
1013
   y : out std_logic);
1014
end or4d;
1015
architecture beh of or4d is
1016
   signal ai : std_logic;
1017
   signal bi : std_logic;
1018
   signal ci : std_logic;
1019
   signal di : std_logic;
1020
begin
1021
   ai <= not a;
1022
   bi <= not b;
1023
   ci <= not c;
1024
   di <= not d;
1025
   y <= di or ci or bi or ai;
1026
end beh;
1027
 
1028
library ieee;
1029
use ieee.std_logic_1164.all;
1030
entity sub1 is
1031
   port(
1032
   a : in std_logic;
1033
   b : in std_logic;
1034
   fci : in std_logic;
1035
   s : out std_logic;
1036
   fco : out std_logic);
1037
end sub1;
1038
architecture beh of sub1 is
1039
   signal un1_b : std_logic;
1040
   signal un3_fco : std_logic;
1041
   signal un1_fco : std_logic;
1042
   signal un4_fco : std_logic;
1043
begin
1044
   un1_b <= not b;
1045
   un3_fco <= a and fci;
1046
   s <= a xor fci xor un1_b;
1047
   un1_fco <= a and un1_b;
1048
   un4_fco <= fci and un1_b;
1049
   fco <= un1_fco or un3_fco or un4_fco;
1050
end beh;
1051
 
1052
 
1053
library ieee;
1054
use ieee.std_logic_1164.all;
1055
entity vcc is
1056
   port(
1057
   y : out std_logic);
1058
end vcc;
1059
architecture beh of vcc is
1060
begin
1061
   y <= '1';
1062
end beh;
1063
 
1064
 
1065
library ieee;
1066
use ieee.std_logic_1164.all;
1067
entity xa1 is
1068
   port(
1069
   a : in std_logic;
1070
   b : in std_logic;
1071
   c : in std_logic;
1072
   y : out std_logic);
1073
end xa1;
1074
architecture beh of xa1 is
1075
   signal xab : std_logic;
1076
begin
1077
   xab <= b xor a;
1078
   y <= c and xab;
1079
end beh;
1080
 
1081
 
1082
library ieee;
1083
use ieee.std_logic_1164.all;
1084
entity xnor2 is
1085
   port(
1086
   a : in std_logic;
1087
   b : in std_logic;
1088
   y : out std_logic);
1089
end xnor2;
1090
architecture beh of xnor2 is
1091
   signal yi : std_logic;
1092
begin
1093
   yi <= b xor a;
1094
   y <= not yi;
1095
end beh;
1096
 
1097
 
1098
library ieee;
1099
use ieee.std_logic_1164.all;
1100
entity xor2 is
1101
   port(
1102
   a : in std_logic;
1103
   b : in std_logic;
1104
   y : out std_logic);
1105
end xor2;
1106
architecture beh of xor2 is
1107
begin
1108
   y <= b xor a;
1109
end beh;
1110
 
1111
 
1112
library ieee;
1113
use ieee.std_logic_1164.all;
1114
entity xor4 is
1115
   port(a,b,c,d : in std_logic;
1116
     y : out std_logic);
1117
end xor4;
1118
architecture beh of xor4 is
1119
   signal xab, xcd : std_logic;
1120
begin
1121
   xab <= b xor a;
1122
   xcd <= c xor d;
1123
   y <= xab xor xcd;
1124
end beh;
1125
 
1126
library ieee;
1127
use ieee.std_logic_1164.all;
1128
entity mx2 is
1129
   port(
1130
   a : in std_logic;
1131
   s : in std_logic;
1132
   b : in std_logic;
1133
   y : out std_logic);
1134
end mx2;
1135
architecture beh of mx2 is
1136
   signal xab : std_logic;
1137
begin
1138
   y <= b when s = '0' else a;
1139
end beh;
1140
 
1141
 
1142
-- pragma translate_on
1143
 

powered by: WebSVN 2.1.0

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