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/] [altera/] [simprims/] [altera_primitives.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimamali
-- Copyright (C) 1991-2007 Altera Corporation
2
-- Your use of Altera Corporation's design tools, logic functions 
3
-- and other software and tools, and its AMPP partner logic 
4
-- functions, and any output files from any of the foregoing 
5
-- (including device programming or simulation files), and any 
6
-- associated documentation or information are expressly subject 
7
-- to the terms and conditions of the Altera Program License 
8
-- Subscription Agreement, Altera MegaCore Function License 
9
-- Agreement, or other applicable license agreement, including, 
10
-- without limitation, that your use is for the sole purpose of 
11
-- programming logic devices manufactured by Altera and sold by 
12
-- Altera or its authorized distributors.  Please refer to the 
13
-- applicable agreement for further details.
14
-- Quartus II 7.2 Build 207 09/26/2007
15
 
16
Library ieee;
17
use ieee.std_logic_1164.all;
18
entity GLOBAL is
19
    port(
20
        a_in                           :  in    std_logic;
21
        a_out                          :  out   std_logic);
22
end GLOBAL;
23
architecture BEHAVIOR of GLOBAL is
24
begin
25
    a_out <= a_in;
26
end BEHAVIOR;
27
 
28
Library ieee;
29
use ieee.std_logic_1164.all;
30
entity CARRY is
31
    port(
32
        a_in                           :  in    std_logic;
33
        a_out                          :  out   std_logic);
34
end CARRY;
35
architecture BEHAVIOR of CARRY is
36
begin
37
    a_out <= a_in;
38
end BEHAVIOR;
39
 
40
Library ieee;
41
use ieee.std_logic_1164.all;
42
entity CASCADE is
43
    port(
44
        a_in                           :  in    std_logic;
45
        a_out                          :  out   std_logic);
46
end CASCADE;
47
architecture BEHAVIOR of CASCADE is
48
begin
49
    a_out <= a_in;
50
end BEHAVIOR;
51
 
52
Library ieee;
53
use ieee.std_logic_1164.all;
54
entity CARRY_SUM is
55
    port(
56
        sin                           :  in    std_logic;
57
        cin                           :  in    std_logic;
58
        sout                          :  out   std_logic;
59
        cout                          :  out   std_logic);
60
end CARRY_SUM;
61
architecture BEHAVIOR of CARRY_SUM is
62
begin
63
    sout <= sin;
64
    cout <= cin;
65
end BEHAVIOR;
66
 
67
Library ieee;
68
use ieee.std_logic_1164.all;
69
entity EXP is
70
    port(
71
        a_in                           :  in    std_logic;
72
        a_out                          :  out   std_logic);
73
end EXP;
74
architecture BEHAVIOR of EXP is
75
begin
76
    a_out <= not a_in;
77
end BEHAVIOR;
78
 
79
Library ieee;
80
use ieee.std_logic_1164.all;
81
entity SOFT is
82
    port(
83
        a_in                        :  in    std_logic;
84
        a_out                       :  out   std_logic);
85
end SOFT;
86
architecture BEHAVIOR of SOFT is
87
begin
88
    a_out <= a_in;
89
end BEHAVIOR;
90
 
91
Library ieee;
92
use ieee.std_logic_1164.all;
93
entity OPNDRN is
94
    port(
95
        a_in                        :  in    std_logic;
96
        a_out                       :  out   std_logic);
97
end OPNDRN;
98
architecture BEHAVIOR of OPNDRN is
99
begin
100
    process (a_in)
101
    begin
102
        if (a_in = '0') then
103
            a_out <= '0';
104
        elsif (a_in = '1') then
105
            a_out <= 'Z';
106
        else
107
            a_out <= 'X';
108
        end if;
109
    end process;
110
end BEHAVIOR;
111
 
112
Library ieee;
113
use ieee.std_logic_1164.all;
114
entity ROW_GLOBAL is
115
    port(
116
        a_in                        :  in    std_logic;
117
        a_out                       :  out   std_logic);
118
end ROW_GLOBAL;
119
architecture BEHAVIOR of ROW_GLOBAL is
120
begin
121
    a_out <= a_in;
122
end BEHAVIOR;
123
 
124
Library ieee;
125
use ieee.std_logic_1164.all;
126
entity TRI is
127
    port(
128
        a_in                        :  in    std_logic;
129
        oe                          :  in    std_logic;
130
        a_out                       :  out   std_logic);
131
end TRI;
132
architecture BEHAVIOR of TRI is
133
begin
134
    a_out <= a_in when oe = '1'
135
        else 'Z';
136
end BEHAVIOR;
137
 
138
Library ieee;
139
use ieee.std_logic_1164.all;
140
entity LUT_INPUT is
141
    port(
142
        a_in                        :  in    std_logic;
143
        a_out                       :  out   std_logic);
144
end LUT_INPUT;
145
architecture BEHAVIOR of LUT_INPUT is
146
begin
147
    a_out <= a_in;
148
end BEHAVIOR;
149
 
150
Library ieee;
151
use ieee.std_logic_1164.all;
152
entity LUT_OUTPUT is
153
    port(
154
        a_in                        :  in    std_logic;
155
        a_out                       :  out   std_logic);
156
end LUT_OUTPUT;
157
architecture BEHAVIOR of LUT_OUTPUT is
158
begin
159
    a_out <= a_in;
160
end BEHAVIOR;
161
 
162
Library ieee;
163
use ieee.std_logic_1164.all;
164
entity latch is
165
    port(
166
        d                        :  in    std_logic;
167
        ena                      :  in    std_logic;
168
        q                        :  out   std_logic);
169
end latch;
170
architecture BEHAVIOR of latch is
171
signal iq : std_logic := '0';
172
begin
173
    process (d, ena)
174
    begin
175
        if (ena = '1') then
176
            iq <= d;
177
        end if;
178
    end process;
179
    q <= iq;
180
end BEHAVIOR;
181
 
182
Library ieee;
183
use ieee.std_logic_1164.all;
184
entity dlatch is
185
    port(
186
        d                        :  in    std_logic;
187
        ena                      :  in    std_logic;
188
        clrn                     :  in    std_logic;
189
        prn                      :  in    std_logic;
190
        q                        :  out   std_logic);
191
end dlatch;
192
architecture BEHAVIOR of dlatch is
193
signal iq : std_logic := '0';
194
begin
195
    process (d, ena, clrn, prn)
196
    begin
197
        if (clrn = '0') then
198
            iq <= '0';
199
        elsif (prn = '0') then
200
            iq <= '1';
201
        elsif (ena = '1') then
202
            iq <= d;
203
        end if;
204
    end process;
205
    q <= iq;
206
end BEHAVIOR;
207
 
208
Library ieee;
209
use ieee.std_logic_1164.all;
210
entity PRIM_GDFF is
211
    port(
212
        d, clk, ena, clr, pre, ald, adt, sclr, sload :  in  std_logic;
213
        q                                            :  out std_logic);
214
end PRIM_GDFF;
215
 
216
architecture BEHAVIOR of PRIM_GDFF is
217
 
218
signal iq : std_logic := '0';
219
signal init : std_logic := '0';
220
signal stalled_adata : std_logic := '0';
221
 
222
begin
223
    process (clk, clr, pre, ald, stalled_adata)
224
    begin
225
        if (clr =  '1') then
226
            iq <= '0';
227
        elsif (pre = '1') then
228
            iq <= '1';
229
        elsif (ald = '1') then
230
            iq <= stalled_adata;
231
        elsif (clk'event and (clk = '1') and (clk'last_value = '0')) then
232
            if (ena = '1') then
233
                if (sclr = '1') then
234
                    iq <= '0';
235
                elsif (sload = '1') then
236
                    iq <= stalled_adata;
237
                else
238
                    iq <= d;
239
                end if;
240
            end if;
241
        end if;
242
    end process;
243
 
244
    process (adt, init)
245
    begin
246
        if (init = '0') then
247
            stalled_adata <= adt;
248
            init <= '1';
249
        else
250
            stalled_adata <= adt after 1 ps;
251
        end if;
252
    end process;
253
 
254
    q <= iq;
255
 
256
end BEHAVIOR; -- PRIM_GDFF
257
 
258
Library ieee;
259
use ieee.std_logic_1164.all;
260
use work.PRIM_GDFF;
261
 
262
entity DFF is
263
    port(
264
        d, clk, clrn, prn :  in  std_logic;
265
        q                 :  out std_logic);
266
end DFF;
267
 
268
architecture BEHAVIOR of DFF is
269
 
270
    component PRIM_GDFF
271
        port(
272
            d, clk, ena, clr, pre, ald, adt, sclr, sload :  in  std_logic;
273
            q                                            :  out std_logic);
274
    end component;
275
 
276
signal clear         : std_logic := '0';
277
signal preset        : std_logic := '0';
278
signal zero_bit      : std_logic := '0';
279
signal one_bit       : std_logic := '1';
280
 
281
begin
282
 
283
    PRIM_GDFF_INST :  PRIM_GDFF
284
        port map (
285
            d     => d,
286
            clk   => clk,
287
            ena   => one_bit,
288
            clr   => clear,
289
            pre   => preset,
290
            ald   => zero_bit,
291
            adt   => zero_bit,
292
            sclr  => zero_bit,
293
            sload => zero_bit,
294
            q     => q );
295
 
296
    clear  <= not clrn;
297
    preset <= not prn;
298
 
299
 
300
end BEHAVIOR; -- DFF
301
 
302
Library ieee;
303
use ieee.std_logic_1164.all;
304
use work.PRIM_GDFF;
305
 
306
entity DFFE is
307
    port(
308
        d, clk, ena, clrn, prn :  in  std_logic;
309
        q                      :  out std_logic);
310
end DFFE;
311
 
312
architecture BEHAVIOR of DFFE is
313
 
314
    component PRIM_GDFF
315
        port(
316
            d, clk, ena, clr, pre, ald, adt, sclr, sload :  in  std_logic;
317
            q                                            :  out std_logic);
318
    end component;
319
 
320
signal clear         : std_logic := '0';
321
signal preset        : std_logic := '0';
322
signal zero_bit      : std_logic := '0';
323
 
324
begin
325
 
326
    PRIM_GDFF_INST :  PRIM_GDFF
327
        port map (
328
            d     => d,
329
            clk   => clk,
330
            ena   => ena,
331
            clr   => clear,
332
            pre   => preset,
333
            ald   => zero_bit,
334
            adt   => zero_bit,
335
            sclr  => zero_bit,
336
            sload => zero_bit,
337
            q     => q );
338
 
339
    clear  <= not clrn;
340
    preset <= not prn;
341
 
342
 
343
end BEHAVIOR; -- DFFE
344
 
345
Library ieee;
346
use ieee.std_logic_1164.all;
347
use work.PRIM_GDFF;
348
 
349
entity DFFEA is
350
    port(
351
        d, clk, ena, clrn, prn, aload, adata :  in  std_logic;
352
        q                                    :  out std_logic);
353
end DFFEA;
354
 
355
architecture BEHAVIOR of DFFEA is
356
 
357
    component PRIM_GDFF
358
        port(
359
            d, clk, ena, clr, pre, ald, adt, sclr, sload :  in  std_logic;
360
            q                                            :  out std_logic);
361
    end component;
362
 
363
signal clear         : std_logic := '0';
364
signal preset        : std_logic := '0';
365
signal zero_bit      : std_logic := '0';
366
 
367
begin
368
 
369
    PRIM_GDFF_INST :  PRIM_GDFF
370
        port map (
371
            d     => d,
372
            clk   => clk,
373
            ena   => ena,
374
            clr   => clear,
375
            pre   => preset,
376
            ald   => aload,
377
            adt   => adata,
378
            sclr  => zero_bit,
379
            sload => zero_bit,
380
            q     => q );
381
 
382
    clear  <= not clrn;
383
    preset <= not prn;
384
 
385
 
386
end BEHAVIOR; -- DFFEA
387
 
388
Library ieee;
389
use ieee.std_logic_1164.all;
390
use IEEE.VITAL_Timing.all;
391
use IEEE.VITAL_Primitives.all;
392
use work.dffeas_pack.all;
393
 
394
entity DFFEAS is
395
    generic(
396
        power_up : string := "DONT_CARE";
397
        is_wysiwyg : string := "false";
398
        x_on_violation : string := "on";
399
        lpm_type : string := "DFFEAS";
400
        tsetup_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
401
        tsetup_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
402
        tsetup_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
403
        tsetup_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
404
        tsetup_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
405
        thold_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
406
        thold_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
407
        thold_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
408
        thold_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
409
        thold_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
410
        tpd_clk_q_posedge : VitalDelayType01 := DefPropDelay01;
411
        tpd_clrn_q_negedge : VitalDelayType01 := DefPropDelay01;
412
        tpd_prn_q_negedge : VitalDelayType01 := DefPropDelay01;
413
        tpd_aload_q_posedge : VitalDelayType01 := DefPropDelay01;
414
        tpd_asdata_q: VitalDelayType01 := DefPropDelay01;
415
        tipd_clk : VitalDelayType01 := DefPropDelay01;
416
        tipd_d : VitalDelayType01 := DefPropDelay01;
417
        tipd_asdata : VitalDelayType01 := DefPropDelay01;
418
        tipd_sclr : VitalDelayType01 := DefPropDelay01;
419
        tipd_sload : VitalDelayType01 := DefPropDelay01;
420
        tipd_clrn : VitalDelayType01 := DefPropDelay01;
421
        tipd_prn : VitalDelayType01 := DefPropDelay01;
422
        tipd_aload : VitalDelayType01 := DefPropDelay01;
423
        tipd_ena : VitalDelayType01 := DefPropDelay01;
424
        TimingChecksOn: Boolean := True;
425
        MsgOn: Boolean := DefGlitchMsgOn;
426
        XOn: Boolean := DefGlitchXOn;
427
        MsgOnChecks: Boolean := DefMsgOnChecks;
428
        XOnChecks: Boolean := DefXOnChecks;
429
        InstancePath: STRING := "*"
430
    );
431
 
432
    port(
433
        d : in std_logic := '0';
434
        clk : in std_logic := '0';
435
        ena : in std_logic := '1';
436
        clrn : in std_logic := '1';
437
        prn : in std_logic := '1';
438
        aload : in std_logic := '0';
439
        asdata : in std_logic := '1';
440
        sclr : in std_logic := '0';
441
        sload : in std_logic := '0';
442
        devclrn : in std_logic := '1';
443
        devpor : in std_logic := '1';
444
        q : out std_logic
445
    );
446
    attribute VITAL_LEVEL0 of dffeas : entity is TRUE;
447
end DFFEAS;
448
 
449
 
450
architecture vital_dffeas of dffeas is
451
    attribute VITAL_LEVEL0 of vital_dffeas : architecture is TRUE;
452
    signal clk_ipd : std_logic;
453
    signal d_ipd : std_logic;
454
    signal d_dly : std_logic;
455
    signal asdata_ipd : std_logic;
456
    signal asdata_dly : std_logic;
457
    signal asdata_dly1 : std_logic;
458
    signal sclr_ipd : std_logic;
459
    signal sload_ipd : std_logic;
460
    signal clrn_ipd : std_logic;
461
    signal prn_ipd : std_logic;
462
    signal aload_ipd : std_logic;
463
    signal ena_ipd : std_logic;
464
 
465
begin
466
 
467
    d_dly <= d_ipd;
468
    asdata_dly <= asdata_ipd;
469
    asdata_dly1 <= asdata_dly;
470
 
471
 
472
    ---------------------
473
    --  INPUT PATH DELAYs
474
    ---------------------
475
    WireDelay : block
476
    begin
477
        VitalWireDelay (clk_ipd, clk, tipd_clk);
478
        VitalWireDelay (d_ipd, d, tipd_d);
479
        VitalWireDelay (asdata_ipd, asdata, tipd_asdata);
480
        VitalWireDelay (sclr_ipd, sclr, tipd_sclr);
481
        VitalWireDelay (sload_ipd, sload, tipd_sload);
482
        VitalWireDelay (clrn_ipd, clrn, tipd_clrn);
483
        VitalWireDelay (prn_ipd, prn, tipd_prn);
484
        VitalWireDelay (aload_ipd, aload, tipd_aload);
485
        VitalWireDelay (ena_ipd, ena, tipd_ena);
486
    end block;
487
 
488
    VITALtiming : process ( clk_ipd, d_dly, asdata_dly1,
489
                            sclr_ipd, sload_ipd, clrn_ipd, prn_ipd, aload_ipd,
490
                            ena_ipd, devclrn, devpor)
491
 
492
    variable Tviol_d_clk : std_ulogic := '0';
493
    variable Tviol_asdata_clk : std_ulogic := '0';
494
    variable Tviol_sclr_clk : std_ulogic := '0';
495
    variable Tviol_sload_clk : std_ulogic := '0';
496
    variable Tviol_ena_clk : std_ulogic := '0';
497
    variable TimingData_d_clk : VitalTimingDataType := VitalTimingDataInit;
498
    variable TimingData_asdata_clk : VitalTimingDataType := VitalTimingDataInit;
499
    variable TimingData_sclr_clk : VitalTimingDataType := VitalTimingDataInit;
500
    variable TimingData_sload_clk : VitalTimingDataType := VitalTimingDataInit;
501
    variable TimingData_ena_clk : VitalTimingDataType := VitalTimingDataInit;
502
    variable q_VitalGlitchData : VitalGlitchDataType;
503
 
504
    variable iq : std_logic := '0';
505
    variable idata: std_logic := '0';
506
 
507
    -- variables for 'X' generation
508
    variable violation : std_logic := '0';
509
 
510
    begin
511
 
512
        if (now = 0 ns) then
513
            if ((power_up = "low") or (power_up = "DONT_CARE")) then
514
                iq := '0';
515
            elsif (power_up = "high") then
516
                iq := '1';
517
            else
518
                iq := '0';
519
            end if;
520
        end if;
521
 
522
        ------------------------
523
        --  Timing Check Section
524
        ------------------------
525
        if (TimingChecksOn) then
526
 
527
            VitalSetupHoldCheck (
528
                Violation       => Tviol_d_clk,
529
                TimingData      => TimingData_d_clk,
530
                TestSignal      => d_ipd,
531
                TestSignalName  => "DATAIN",
532
                RefSignal       => clk_ipd,
533
                RefSignalName   => "CLK",
534
                SetupHigh       => tsetup_d_clk_noedge_posedge,
535
                SetupLow        => tsetup_d_clk_noedge_posedge,
536
                HoldHigh        => thold_d_clk_noedge_posedge,
537
                HoldLow         => thold_d_clk_noedge_posedge,
538
                CheckEnabled    => TO_X01(  (NOT clrn_ipd) OR
539
                                            (NOT prn_ipd) OR
540
                                            (sload_ipd) OR
541
                                            (sclr_ipd) OR
542
                                            (NOT devpor) OR
543
                                            (NOT devclrn) OR
544
                                            (NOT ena_ipd)) /= '1',
545
                RefTransition   => '/',
546
                HeaderMsg       => InstancePath & "/DFFEAS",
547
                XOn             => XOnChecks,
548
                MsgOn           => MsgOnChecks );
549
 
550
            VitalSetupHoldCheck (
551
                Violation       => Tviol_asdata_clk,
552
                TimingData      => TimingData_asdata_clk,
553
                TestSignal      => asdata_ipd,
554
                TestSignalName  => "ASDATA",
555
                RefSignal       => clk_ipd,
556
                RefSignalName   => "CLK",
557
                SetupHigh       => tsetup_asdata_clk_noedge_posedge,
558
                SetupLow        => tsetup_asdata_clk_noedge_posedge,
559
                HoldHigh        => thold_asdata_clk_noedge_posedge,
560
                HoldLow         => thold_asdata_clk_noedge_posedge,
561
                CheckEnabled    => TO_X01(  (NOT clrn_ipd) OR
562
                                            (NOT prn_ipd) OR
563
                                            (NOT sload_ipd) OR
564
                                            (NOT devpor) OR
565
                                            (NOT devclrn) OR
566
                                            (NOT ena_ipd)) /= '1',
567
                RefTransition   => '/',
568
                HeaderMsg       => InstancePath & "/DFFEAS",
569
                XOn             => XOnChecks,
570
                MsgOn           => MsgOnChecks );
571
 
572
            VitalSetupHoldCheck (
573
                Violation       => Tviol_sclr_clk,
574
                TimingData      => TimingData_sclr_clk,
575
                TestSignal      => sclr_ipd,
576
                TestSignalName  => "SCLR",
577
                RefSignal       => clk_ipd,
578
                RefSignalName   => "CLK",
579
                SetupHigh       => tsetup_sclr_clk_noedge_posedge,
580
                SetupLow        => tsetup_sclr_clk_noedge_posedge,
581
                HoldHigh        => thold_sclr_clk_noedge_posedge,
582
                HoldLow         => thold_sclr_clk_noedge_posedge,
583
                CheckEnabled    => TO_X01(  (NOT clrn_ipd) OR
584
                                            (NOT prn_ipd) OR
585
                                            (NOT devpor) OR
586
                                            (NOT devclrn) OR
587
                                            (NOT ena_ipd)) /= '1',
588
                RefTransition   => '/',
589
                HeaderMsg       => InstancePath & "/DFFEAS",
590
                XOn             => XOnChecks,
591
                MsgOn           => MsgOnChecks );
592
 
593
            VitalSetupHoldCheck (
594
                Violation       => Tviol_sload_clk,
595
                TimingData      => TimingData_sload_clk,
596
                TestSignal      => sload_ipd,
597
                TestSignalName  => "SLOAD",
598
                RefSignal       => clk_ipd,
599
                RefSignalName   => "CLK",
600
                SetupHigh       => tsetup_sload_clk_noedge_posedge,
601
                SetupLow        => tsetup_sload_clk_noedge_posedge,
602
                HoldHigh        => thold_sload_clk_noedge_posedge,
603
                HoldLow         => thold_sload_clk_noedge_posedge,
604
                CheckEnabled    => TO_X01(  (NOT clrn_ipd) OR
605
                                            (NOT prn_ipd) OR
606
                                            (NOT devpor) OR
607
                                            (NOT devclrn) OR
608
                                            (NOT ena_ipd)) /= '1',
609
                RefTransition   => '/',
610
                HeaderMsg       => InstancePath & "/DFFEAS",
611
                XOn             => XOnChecks,
612
                MsgOn           => MsgOnChecks );
613
 
614
            VitalSetupHoldCheck (
615
                Violation       => Tviol_ena_clk,
616
                TimingData      => TimingData_ena_clk,
617
                TestSignal      => ena_ipd,
618
                TestSignalName  => "ENA",
619
                RefSignal       => clk_ipd,
620
                RefSignalName   => "CLK",
621
                SetupHigh       => tsetup_ena_clk_noedge_posedge,
622
                SetupLow        => tsetup_ena_clk_noedge_posedge,
623
                HoldHigh        => thold_ena_clk_noedge_posedge,
624
                HoldLow         => thold_ena_clk_noedge_posedge,
625
                CheckEnabled    => TO_X01(  (NOT clrn_ipd) OR
626
                                            (NOT prn_ipd) OR
627
                                            (NOT devpor) OR
628
                                            (NOT devclrn) ) /= '1',
629
                RefTransition   => '/',
630
                HeaderMsg       => InstancePath & "/DFFEAS",
631
                XOn             => XOnChecks,
632
                MsgOn           => MsgOnChecks );
633
        end if;
634
 
635
        violation := Tviol_d_clk or Tviol_asdata_clk or
636
                        Tviol_sclr_clk or Tviol_sload_clk or Tviol_ena_clk;
637
 
638
 
639
        if ((devpor = '0') or (devclrn = '0') or (clrn_ipd = '0'))  then
640
            iq := '0';
641
        elsif (prn_ipd = '0') then
642
            iq := '1';
643
        elsif (aload_ipd = '1') then
644
            iq := asdata_dly1;
645
        elsif (violation = 'X' and x_on_violation = "on") then
646
            iq := 'X';
647
        elsif clk_ipd'event and clk_ipd = '1' and clk_ipd'last_value = '0' then
648
            if (ena_ipd = '1') then
649
                if (sclr_ipd = '1') then
650
                    iq := '0';
651
                elsif (sload_ipd = '1') then
652
                    iq := asdata_dly1;
653
                else
654
                    iq := d_dly;
655
                end if;
656
            end if;
657
        end if;
658
 
659
        ----------------------
660
        --  Path Delay Section
661
        ----------------------
662
        VitalPathDelay01 (
663
            OutSignal => q,
664
            OutSignalName => "Q",
665
            OutTemp => iq,
666
            Paths =>   (0 => (clrn_ipd'last_event, tpd_clrn_q_negedge, TRUE),
667
                        1 => (prn_ipd'last_event, tpd_prn_q_negedge, TRUE),
668
                        2 => (aload_ipd'last_event, tpd_aload_q_posedge, TRUE),
669
                        3 => (asdata_ipd'last_event, tpd_asdata_q, TRUE),
670
                        4 => (clk_ipd'last_event, tpd_clk_q_posedge, TRUE)),
671
            GlitchData => q_VitalGlitchData,
672
            Mode => DefGlitchMode,
673
            XOn  => XOn,
674
            MsgOn  => MsgOn );
675
 
676
    end process;
677
 
678
end vital_dffeas;
679
 
680
Library ieee;
681
use ieee.std_logic_1164.all;
682
entity PRIM_GTFF is
683
    port(
684
        t, clk, ena, clr, pre :  in  std_logic;
685
        q                     :  out std_logic);
686
end PRIM_GTFF;
687
 
688
architecture BEHAVIOR of PRIM_GTFF is
689
 
690
signal iq : std_logic := '0';
691
signal init : std_logic := '0';
692
 
693
begin
694
    process (clk, clr, pre)
695
    begin
696
        if (clr =  '1') then
697
            iq <= '0';
698
        elsif (pre = '1') then
699
            iq <= '1';
700
        elsif (clk'event and (clk = '1') and (clk'last_value = '0')) then
701
            if (ena = '1') then
702
                if (t = '1') then
703
                    iq <= not iq;
704
                end if;
705
            end if;
706
        end if;
707
    end process;
708
 
709
    q <= iq;
710
 
711
end BEHAVIOR; -- PRIM_GTFF
712
 
713
Library ieee;
714
use ieee.std_logic_1164.all;
715
use work.PRIM_GTFF;
716
 
717
entity TFF is
718
    port(
719
        t, clk, clrn, prn :  in  std_logic;
720
        q                 :  out std_logic);
721
end TFF;
722
 
723
architecture BEHAVIOR of TFF is
724
 
725
    component PRIM_GTFF
726
        port(
727
            t, clk, ena, clr, pre :  in  std_logic;
728
            q                     :  out std_logic);
729
    end component;
730
 
731
signal clear         : std_logic := '0';
732
signal preset        : std_logic := '0';
733
signal one_bit       : std_logic := '1';
734
 
735
begin
736
 
737
    PRIM_GTFF_INST :  PRIM_GTFF
738
        port map (
739
            t     => t,
740
            clk   => clk,
741
            ena   => one_bit,
742
            clr   => clear,
743
            pre   => preset,
744
            q     => q );
745
 
746
    clear  <= not clrn;
747
    preset <= not prn;
748
 
749
 
750
end BEHAVIOR; -- TFF
751
 
752
Library ieee;
753
use ieee.std_logic_1164.all;
754
use work.PRIM_GTFF;
755
 
756
entity TFFE is
757
    port(
758
        t, clk, ena, clrn, prn :  in  std_logic;
759
        q                      :  out std_logic);
760
end TFFE;
761
 
762
architecture BEHAVIOR of TFFE is
763
 
764
    component PRIM_GTFF
765
        port(
766
            t, clk, ena, clr, pre :  in  std_logic;
767
            q                     :  out std_logic);
768
    end component;
769
 
770
signal clear         : std_logic := '0';
771
signal preset        : std_logic := '0';
772
 
773
begin
774
 
775
    PRIM_GTFF_INST :  PRIM_GTFF
776
        port map (
777
            t     => t,
778
            clk   => clk,
779
            ena   => ena,
780
            clr   => clear,
781
            pre   => preset,
782
            q     => q );
783
 
784
    clear  <= not clrn;
785
    preset <= not prn;
786
 
787
 
788
end BEHAVIOR; -- TFFE
789
 
790
 
791
Library ieee;
792
use ieee.std_logic_1164.all;
793
entity PRIM_GJKFF is
794
    port(
795
        j, k, clk, ena, clr, pre :  in  std_logic;
796
        q                        :  out std_logic);
797
end PRIM_GJKFF;
798
 
799
architecture BEHAVIOR of PRIM_GJKFF is
800
 
801
signal iq : std_logic := '0';
802
 
803
begin
804
    process (clk, clr, pre)
805
    begin
806
        if (clr =  '1') then
807
            iq <= '0';
808
        elsif (pre = '1') then
809
            iq <= '1';
810
        elsif (clk'event and (clk = '1') and (clk'last_value = '0')) then
811
            if (ena = '1') then
812
                if ((j = '1') and (k = '0')) then
813
                    iq <= '1';
814
                elsif ((j = '0') and (k = '1')) then
815
                    iq <= '0';
816
                elsif ((j = '1') and (k = '1')) then
817
                    iq <= not iq;
818
                end if;
819
            end if;
820
        end if;
821
    end process;
822
 
823
    q <= iq;
824
 
825
end BEHAVIOR; -- PRIM_GJKFF
826
 
827
Library ieee;
828
use ieee.std_logic_1164.all;
829
use work.PRIM_GJKFF;
830
 
831
entity JKFF is
832
    port(
833
        j, k, clk, clrn, prn :  in  std_logic;
834
        q                    :  out std_logic);
835
end JKFF;
836
 
837
architecture BEHAVIOR of JKFF is
838
 
839
    component PRIM_GJKFF
840
        port(
841
            j, k, clk, ena, clr, pre :  in  std_logic;
842
            q                        :  out std_logic);
843
    end component;
844
 
845
signal clear         : std_logic := '0';
846
signal preset        : std_logic := '0';
847
signal one_bit       : std_logic := '1';
848
 
849
begin
850
 
851
    PRIM_GJKFF_INST :  PRIM_GJKFF
852
        port map (
853
            j     => j,
854
            k     => k,
855
            clk   => clk,
856
            ena   => one_bit,
857
            clr   => clear,
858
            pre   => preset,
859
            q     => q );
860
 
861
    clear  <= not clrn;
862
    preset <= not prn;
863
 
864
 
865
end BEHAVIOR; -- JKFF
866
 
867
Library ieee;
868
use ieee.std_logic_1164.all;
869
use work.PRIM_GJKFF;
870
 
871
entity JKFFE is
872
    port(
873
        j, k, clk, ena, clrn, prn :  in  std_logic;
874
        q                         :  out std_logic);
875
end JKFFE;
876
 
877
architecture BEHAVIOR of JKFFE is
878
 
879
    component PRIM_GJKFF
880
        port(
881
            j, k, clk, ena, clr, pre :  in  std_logic;
882
            q                        :  out std_logic);
883
    end component;
884
 
885
signal clear         : std_logic := '0';
886
signal preset        : std_logic := '0';
887
 
888
begin
889
 
890
    PRIM_GJKFF_INST :  PRIM_GJKFF
891
        port map (
892
            j     => j,
893
            k     => k,
894
            clk   => clk,
895
            ena   => ena,
896
            clr   => clear,
897
            pre   => preset,
898
            q     => q );
899
 
900
    clear  <= not clrn;
901
    preset <= not prn;
902
 
903
 
904
end BEHAVIOR; -- JKFFE
905
 
906
Library ieee;
907
use ieee.std_logic_1164.all;
908
entity PRIM_GSRFF is
909
    port(
910
        s, r, clk, ena, clr, pre :  in  std_logic;
911
        q                        :  out std_logic);
912
end PRIM_GSRFF;
913
 
914
architecture BEHAVIOR of PRIM_GSRFF is
915
 
916
signal iq : std_logic := '0';
917
 
918
begin
919
    process (clk, clr, pre)
920
    begin
921
        if (clr =  '1') then
922
            iq <= '0';
923
        elsif (pre = '1') then
924
            iq <= '1';
925
        elsif (clk'event and (clk = '1') and (clk'last_value = '0')) then
926
            if (ena = '1') then
927
                if ((s = '1') and (r = '0')) then
928
                    iq <= '1';
929
                elsif ((s = '0') and (r = '1')) then
930
                    iq <= '0';
931
                elsif ((s = '1') and (r = '1')) then
932
                    iq <= not iq;
933
                end if;
934
            end if;
935
        end if;
936
    end process;
937
 
938
    q <= iq;
939
 
940
end BEHAVIOR; -- PRIM_GSRFF
941
 
942
Library ieee;
943
use ieee.std_logic_1164.all;
944
use work.PRIM_GSRFF;
945
 
946
entity SRFF is
947
    port(
948
        s, r, clk, clrn, prn :  in  std_logic;
949
        q                    :  out std_logic);
950
end SRFF;
951
 
952
architecture BEHAVIOR of SRFF is
953
 
954
    component PRIM_GSRFF
955
        port(
956
            s, r, clk, ena, clr, pre :  in  std_logic;
957
            q                        :  out std_logic);
958
    end component;
959
 
960
signal clear         : std_logic := '0';
961
signal preset        : std_logic := '0';
962
signal one_bit       : std_logic := '1';
963
 
964
begin
965
 
966
    PRIM_GSRFF_INST :  PRIM_GSRFF
967
        port map (
968
            s     => s,
969
            r     => r,
970
            clk   => clk,
971
            ena   => one_bit,
972
            clr   => clear,
973
            pre   => preset,
974
            q     => q );
975
 
976
    clear  <= not clrn;
977
    preset <= not prn;
978
 
979
 
980
end BEHAVIOR; -- SRFF
981
 
982
Library ieee;
983
use ieee.std_logic_1164.all;
984
use work.PRIM_GSRFF;
985
 
986
entity SRFFE is
987
    port(
988
        s, r, clk, ena, clrn, prn :  in  std_logic;
989
        q                         :  out std_logic);
990
end SRFFE;
991
 
992
architecture BEHAVIOR of SRFFE is
993
 
994
    component PRIM_GSRFF
995
        port(
996
            s, r, clk, ena, clr, pre :  in  std_logic;
997
            q                        :  out std_logic);
998
    end component;
999
 
1000
signal clear         : std_logic := '0';
1001
signal preset        : std_logic := '0';
1002
 
1003
begin
1004
 
1005
    PRIM_GSRFF_INST :  PRIM_GSRFF
1006
        port map (
1007
            s     => s,
1008
            r     => r,
1009
            clk   => clk,
1010
            ena   => ena,
1011
            clr   => clear,
1012
            pre   => preset,
1013
            q     => q );
1014
 
1015
    clear  <= not clrn;
1016
    preset <= not prn;
1017
 
1018
 
1019
end BEHAVIOR; -- SRFFE
1020
 
1021
 
1022
library ieee;
1023
use ieee.std_logic_1164.all;
1024
 
1025
-- ENTITY DECLARATION
1026
entity clklock is
1027
generic(
1028
    input_frequency       : natural := 10000;   -- units in ps
1029
    clockboost            : natural := 1
1030
 
1031
);
1032
port(
1033
    inclk   : in std_logic;  -- required port, input reference clock
1034
    outclk  : out std_logic  -- outclk output
1035
);
1036
end clklock;
1037
-- END ENTITY DECLARATION
1038
 
1039
-- BEGINNING OF ARCHITECTURE BEHAVIOR
1040
architecture behavior of clklock is
1041
 
1042
-- CONSTANT DECLARATION
1043
constant valid_lock_cycles       : natural := 1;
1044
constant invalid_lock_cycles     : natural := 2;
1045
 
1046
-- SIGNAL DECLARATION
1047
SIGNAL pll_lock      : std_logic := '0';
1048
SIGNAL check_lock    : std_logic := '0';
1049
SIGNAL outclk_tmp    : std_logic := 'X';
1050
begin
1051
 
1052
-- checking for invalid parameters
1053
MSG: process
1054
begin
1055
    if (input_frequency <= 0) then
1056
        ASSERT FALSE
1057
        REPORT "The period of the input clock (input_frequency) must be greater than 0!"
1058
        SEVERITY ERROR;
1059
    end if;
1060
 
1061
    if ((clockboost /= 1) and (clockboost /= 2)) then
1062
        ASSERT FALSE
1063
        REPORT "The clock multiplication factor (clockboost) must be a value of 1 or 2!"
1064
        SEVERITY ERROR;
1065
    end if;
1066
 
1067
    wait;
1068
 
1069
end process MSG;
1070
 
1071
LOCK: process(inclk, pll_lock, check_lock)
1072
    -- VARIABLE DECLARATION
1073
    variable inclk_ps : time := 0 ps;
1074
    variable violation : boolean := false;
1075
    variable pll_lock_tmp : std_logic := '0';
1076
    variable start_lock_count, stop_lock_count : integer := 0;
1077
    variable pll_last_rising_edge, pll_last_falling_edge : time := 0 ps;
1078
    variable pll_rising_edge_count : integer := 0;
1079
    variable pll_cycle, pll_duty_cycle : time := 0 ps;
1080
    variable expected_next_clk_edge : time := 0 ps;
1081
    variable clk_per_tolerance : time := 0 ps;
1082
 
1083
    variable last_synchronizing_rising_edge_for_outclk : time := 0 ps;
1084
    variable input_cycles_per_outclk            : integer := 1;
1085
    variable input_cycle_count_to_sync0 : integer := 0;
1086
    variable init : boolean := true;
1087
    variable output_value : std_logic := '0';
1088
    variable vco_per : time := 0 ps;
1089
    variable high_time : time := 0 ps;
1090
    variable low_time : time := 0 ps;
1091
    variable sched_time : time := 0 ps;
1092
    variable tmp_per  : integer := 0;
1093
    variable temp, tmp_rem, my_rem : integer := 0;
1094
    variable inc : integer := 1;
1095
    variable cycle_to_adjust : integer := 0;
1096
    variable outclk_synchronizing_period : time;
1097
    variable outclk_cycles_per_sync_period      : integer := clockboost;
1098
    variable schedule_outclk : boolean := false;
1099
begin
1100
    if (init) then
1101
        outclk_cycles_per_sync_period := clockboost;
1102
        input_cycles_per_outclk := 1;
1103
 
1104
        clk_per_tolerance := (0.1 * real(input_frequency)) * 1 ps;
1105
        init := false;
1106
    end if;
1107
 
1108
    if (inclk'event and inclk = '1') then
1109
        if (pll_lock_tmp = '1') then
1110
            check_lock <= not check_lock after (inclk_ps+clk_per_tolerance)/2.0;
1111
        end if;
1112
        if pll_rising_edge_count = 0 then      -- at 1st rising edge
1113
            inclk_ps := (input_frequency / 1) * 1 ps;
1114
            pll_duty_cycle := inclk_ps/2;
1115
        elsif pll_rising_edge_count = 1 then      -- at 2nd rising edge
1116
            pll_cycle := now - pll_last_rising_edge;    -- calculate period
1117
            if ((NOW - pll_last_rising_edge) < (inclk_ps - clk_per_tolerance)  or
1118
                (NOW - pll_last_rising_edge) > (inclk_ps + clk_per_tolerance)) then
1119
                ASSERT FALSE
1120
                REPORT "Inclock_Period Violation"
1121
                SEVERITY WARNING;
1122
                violation := true;
1123
                if (pll_lock = '1') then
1124
                    stop_lock_count := stop_lock_count + 1;
1125
                    if (stop_lock_count = invalid_lock_cycles) then
1126
                        pll_lock_tmp := '0';
1127
                        ASSERT FALSE
1128
                        REPORT "clklock out of lock."
1129
                        SEVERITY WARNING;
1130
                    end if;
1131
                else
1132
                    start_lock_count := 1;
1133
                end if;
1134
            else
1135
                violation := false;
1136
            end if;
1137
            if ((now - pll_last_falling_edge) < (pll_duty_cycle - clk_per_tolerance/2) or
1138
                (now - pll_last_falling_edge) > (pll_duty_cycle + clk_per_tolerance/2)) then
1139
                ASSERT FALSE
1140
                REPORT "Duty Cycle Violation"
1141
                SEVERITY WARNING;
1142
                violation := true;
1143
            else
1144
                violation := false;
1145
            end if;
1146
        else
1147
            pll_cycle := now - pll_last_rising_edge;    -- calculate period
1148
            if ((now - pll_last_rising_edge) < (inclk_ps - clk_per_tolerance) or
1149
                (now - pll_last_rising_edge) > (inclk_ps + clk_per_tolerance)) then
1150
                ASSERT FALSE
1151
                REPORT "Cycle Violation"
1152
                SEVERITY WARNING;
1153
                violation := true;
1154
                if (pll_lock = '1') then
1155
                    stop_lock_count := stop_lock_count + 1;
1156
                    if (stop_lock_count = invalid_lock_cycles) then
1157
                        pll_lock_tmp := '0';
1158
                        ASSERT FALSE
1159
                        REPORT "clklock out of lock."
1160
                        SEVERITY WARNING;
1161
                    end if;
1162
                else
1163
                    start_lock_count := 1;
1164
                end if;
1165
            else
1166
                violation := false;
1167
            end if;
1168
        end if;
1169
        pll_last_rising_edge := now;
1170
        pll_rising_edge_count := pll_rising_edge_count +1;
1171
        if (not violation) then
1172
            if (pll_lock_tmp = '1') then
1173
                input_cycle_count_to_sync0 := input_cycle_count_to_sync0 + 1;
1174
                if (input_cycle_count_to_sync0 = input_cycles_per_outclk) then
1175
                    outclk_synchronizing_period := now - last_synchronizing_rising_edge_for_outclk;
1176
                    last_synchronizing_rising_edge_for_outclk := now;
1177
                    schedule_outclk := true;
1178
                    input_cycle_count_to_sync0 := 0;
1179
                end if;
1180
            else
1181
                start_lock_count := start_lock_count + 1;
1182
                if (start_lock_count >= valid_lock_cycles) then
1183
                    pll_lock_tmp := '1';
1184
                    input_cycle_count_to_sync0 := 0;
1185
                    outclk_synchronizing_period := ((pll_cycle/1 ps) * input_cycles_per_outclk) * 1 ps;
1186
                    last_synchronizing_rising_edge_for_outclk := now;
1187
                    schedule_outclk := true;
1188
                end if;
1189
            end if;
1190
        else
1191
            start_lock_count := 1;
1192
        end if;
1193
 
1194
    elsif (inclk'event and inclk= '0') then
1195
        if (pll_lock_tmp = '1') then
1196
            check_lock <= not check_lock after (inclk_ps+clk_per_tolerance)/2.0;
1197
            if (now > 0 ns and ((now - pll_last_rising_edge) < (pll_duty_cycle - clk_per_tolerance/2) or
1198
                (now - pll_last_rising_edge) > (pll_duty_cycle + clk_per_tolerance/2))) then
1199
                ASSERT FALSE
1200
                REPORT "Duty Cycle Violation"
1201
                SEVERITY WARNING;
1202
                violation := true;
1203
                if (pll_lock = '1') then
1204
                    stop_lock_count := stop_lock_count + 1;
1205
                    if (stop_lock_count = invalid_lock_cycles) then
1206
                        pll_lock_tmp := '0';
1207
                        ASSERT FALSE
1208
                        REPORT "clklock out of lock."
1209
                        SEVERITY WARNING;
1210
                    end if;
1211
                end if;
1212
            else
1213
                violation := false;
1214
            end if;
1215
        else
1216
            start_lock_count := start_lock_count + 1;
1217
        end if;
1218
        pll_last_falling_edge := now;
1219
    else
1220
        if pll_lock_tmp = '1' then
1221
            if (inclk = '1') then
1222
                expected_next_clk_edge := pll_last_rising_edge + (inclk_ps+clk_per_tolerance)/2.0;
1223
            else
1224
                expected_next_clk_edge := pll_last_falling_edge + (inclk_ps+clk_per_tolerance)/2.0;
1225
            end if;
1226
            violation := false;
1227
            if (now < expected_next_clk_edge) then
1228
                check_lock <= not check_lock after (expected_next_clk_edge - now);
1229
            elsif (now = expected_next_clk_edge) then
1230
                check_lock <= not check_lock after (inclk_ps+clk_per_tolerance)/2.0;
1231
            else
1232
                ASSERT FALSE
1233
                REPORT "Inclock_Period Violation"
1234
                SEVERITY WARNING;
1235
                violation := true;
1236
                if (pll_lock = '1') then
1237
                    stop_lock_count := stop_lock_count + 1;
1238
                    if (stop_lock_count = invalid_lock_cycles) then
1239
                        pll_lock_tmp := '0';
1240
                        ASSERT FALSE
1241
                        REPORT "clklock out of lock."
1242
                        SEVERITY WARNING;
1243
                    else
1244
                        check_lock <= not check_lock after (inclk_ps/2.0);
1245
                    end if;
1246
                end if;
1247
            end if;
1248
        end if;
1249
    end if;
1250
    pll_lock <= pll_lock_tmp;
1251
    if (pll_lock'event and pll_lock = '0') then
1252
        start_lock_count := 1;
1253
        stop_lock_count := 0;
1254
        outclk_tmp <= 'X';
1255
    end if;
1256
 
1257
    -- outclk output
1258
    if (schedule_outclk = true) then
1259
        -- initialize variables
1260
        sched_time := 0 ps;
1261
        cycle_to_adjust := 0;
1262
        inc := 1;
1263
        output_value := '1';
1264
        temp := outclk_synchronizing_period / 1 ps;
1265
        my_rem := temp rem outclk_cycles_per_sync_period;
1266
 
1267
        -- schedule <outclk_cycles_per_sync_period> number of output clock
1268
        -- cycles in this loop in order to synchronize the output clock to the
1269
        -- input clock - to get rid of drifting for cases where the input clock
1270
        -- period is not always divisible
1271
        for i in 1 to outclk_cycles_per_sync_period loop
1272
            tmp_per := temp/outclk_cycles_per_sync_period;
1273
            if ((my_rem /= 0) and (inc <= my_rem)) then
1274
                tmp_rem := (outclk_cycles_per_sync_period * inc) rem my_rem;
1275
                cycle_to_adjust := (outclk_cycles_per_sync_period * inc) / my_rem;
1276
                if (tmp_rem /= 0) then
1277
                    cycle_to_adjust := cycle_to_adjust + 1;
1278
                end if;
1279
            end if;
1280
 
1281
            -- if this cycle is the one to adjust the output period in, then
1282
            -- increment the period by 1 unit
1283
            if (cycle_to_adjust = i) then
1284
                tmp_per := tmp_per + 1;
1285
                inc := inc + 1;
1286
            end if;
1287
 
1288
            -- adjust the high and low cycle period
1289
            vco_per := tmp_per * 1 ps;
1290
            high_time := (tmp_per / 2) * 1 ps;
1291
            if ((tmp_per rem 2) /= 0) then
1292
                high_time := high_time + 1 ps;
1293
            end if;
1294
 
1295
            low_time := vco_per - high_time;
1296
 
1297
            -- schedule the high and low cycle of 1 output clock period
1298
            for j in 1 to 2 loop
1299
                outclk_tmp <= transport output_value after sched_time;
1300
                output_value := not output_value;
1301
                if (output_value = '0') then
1302
                    sched_time := sched_time + high_time;
1303
                elsif (output_value = '1') then
1304
                    sched_time := sched_time + low_time;
1305
                end if;
1306
            end loop;
1307
        end loop;
1308
 
1309
        -- reset schedule_outclk
1310
        schedule_outclk := false;
1311
    end if; -- schedule_outclk
1312
end process LOCK;
1313
 
1314
    outclk <= outclk_tmp;
1315
 
1316
end behavior;
1317
-- END ARCHITECTURE BEHAVIOR
1318
 
1319
 
1320
Library ieee;
1321
use ieee.std_logic_1164.all;
1322
entity alt_inbuf is
1323
    generic(
1324
        io_standard           : string := "NONE";
1325
        location              : string := "NONE";
1326
        enable_bus_hold       : string := "NONE";
1327
        weak_pull_up_resistor : string := "NONE";
1328
        termination           : string := "NONE";
1329
        lpm_type              : string := "alt_inbuf" );
1330
    port(
1331
        i : in  std_logic;
1332
        o : out std_logic);
1333
end alt_inbuf;
1334
architecture BEHAVIOR of alt_inbuf is
1335
begin
1336
    o <= i;
1337
end BEHAVIOR;
1338
 
1339
Library ieee;
1340
use ieee.std_logic_1164.all;
1341
entity alt_outbuf is
1342
    generic(
1343
        io_standard           : string  := "NONE";
1344
        current_strength      : string  := "NONE";
1345
        current_strength_new  : string  := "NONE";
1346
        slew_rate             : integer := -1;
1347
        slow_slew_rate        : string  := "NONE";
1348
        location              : string  := "NONE";
1349
        enable_bus_hold       : string  := "NONE";
1350
        weak_pull_up_resistor : string  := "NONE";
1351
        termination           : string  := "NONE";
1352
        lpm_type              : string := "alt_outbuf" );
1353
    port(
1354
        i : in  std_logic;
1355
        o : out std_logic);
1356
end alt_outbuf;
1357
architecture BEHAVIOR of alt_outbuf is
1358
begin
1359
    o <= i;
1360
end BEHAVIOR;
1361
 
1362
Library ieee;
1363
use ieee.std_logic_1164.all;
1364
entity alt_outbuf_tri is
1365
    generic(
1366
        io_standard           : string  := "NONE";
1367
        current_strength      : string  := "NONE";
1368
        current_strength_new  : string  := "NONE";
1369
        slew_rate             : integer := -1;
1370
        slow_slew_rate        : string  := "NONE";
1371
        location              : string  := "NONE";
1372
        enable_bus_hold       : string  := "NONE";
1373
        weak_pull_up_resistor : string  := "NONE";
1374
        termination           : string  := "NONE";
1375
        lpm_type              : string := "alt_outbuf_tri" );
1376
    port(
1377
        i  : in  std_logic;
1378
        oe : in  std_logic;
1379
        o  : out std_logic);
1380
end alt_outbuf_tri;
1381
architecture BEHAVIOR of alt_outbuf_tri is
1382
begin
1383
    o <= i when oe = '1'
1384
        else 'Z';
1385
end BEHAVIOR;
1386
 
1387
Library ieee;
1388
use ieee.std_logic_1164.all;
1389
entity alt_iobuf is
1390
    generic(
1391
        io_standard           : string  := "NONE";
1392
        current_strength      : string  := "NONE";
1393
        current_strength_new  : string  := "NONE";
1394
        slew_rate             : integer := -1;
1395
        slow_slew_rate        : string  := "NONE";
1396
        location              : string  := "NONE";
1397
        enable_bus_hold       : string  := "NONE";
1398
        weak_pull_up_resistor : string  := "NONE";
1399
        termination           : string  := "NONE";
1400
        input_termination     : string  := "NONE";
1401
        output_termination    : string  := "NONE";
1402
        lpm_type              : string := "alt_iobuf" );
1403
    port(
1404
        i  : in    std_logic;
1405
        oe : in    std_logic;
1406
        io : inout std_logic;
1407
        o  : out   std_logic);
1408
end alt_iobuf;
1409
architecture BEHAVIOR of alt_iobuf is
1410
begin
1411
    process(i, io, oe)
1412
    begin
1413
        if oe = '1' then
1414
            io <= i;
1415
        else
1416
            io <= 'Z';
1417
        end if;
1418
        o <= io;
1419
    end process;
1420
end BEHAVIOR;
1421
 
1422
Library ieee;
1423
use ieee.std_logic_1164.all;
1424
entity alt_inbuf_diff is
1425
    generic(
1426
        io_standard           : string := "NONE";
1427
        location              : string := "NONE";
1428
        enable_bus_hold       : string := "NONE";
1429
        weak_pull_up_resistor : string := "NONE";
1430
        termination           : string := "NONE";
1431
        lpm_type              : string := "alt_inbuf_diff" );
1432
    port(
1433
        i    : in  std_logic;
1434
        ibar : in  std_logic;
1435
        o    : out std_logic);
1436
end alt_inbuf_diff;
1437
architecture BEHAVIOR of alt_inbuf_diff is
1438
begin
1439
    process(i, ibar)
1440
    variable out_tmp : std_logic;
1441
    variable in_tmp  : std_logic_vector(1 downto 0);
1442
    begin
1443
        in_tmp(0) := ibar;
1444
        in_tmp(1) := i;
1445
        case in_tmp is
1446
            when "00" => out_tmp := 'X';
1447
            when "01" => out_tmp := '0';
1448
            when "10" => out_tmp := '1';
1449
            when "11" => out_tmp := 'X';
1450
            when others => out_tmp := 'X';
1451
        end case;
1452
        o <= out_tmp;
1453
    end process;
1454
end BEHAVIOR;
1455
 
1456
Library ieee;
1457
use ieee.std_logic_1164.all;
1458
entity alt_outbuf_diff is
1459
    generic(
1460
        io_standard           : string  := "NONE";
1461
        current_strength      : string  := "NONE";
1462
        current_strength_new  : string  := "NONE";
1463
        slew_rate             : integer := -1;
1464
        location              : string  := "NONE";
1465
        enable_bus_hold       : string  := "NONE";
1466
        weak_pull_up_resistor : string  := "NONE";
1467
        termination           : string  := "NONE";
1468
        lpm_type              : string := "alt_outbuf_diff" );
1469
    port(
1470
        i   : in  std_logic;
1471
        o   : out std_logic;
1472
        obar : out std_logic);
1473
end alt_outbuf_diff;
1474
architecture BEHAVIOR of alt_outbuf_diff is
1475
begin
1476
    o <= i;
1477
    obar <= not i;
1478
end BEHAVIOR;
1479
 
1480
Library ieee;
1481
use ieee.std_logic_1164.all;
1482
entity alt_outbuf_tri_diff is
1483
    generic(
1484
        io_standard           : string  := "NONE";
1485
        current_strength      : string  := "NONE";
1486
        current_strength_new  : string  := "NONE";
1487
        slew_rate             : integer := -1;
1488
        location              : string  := "NONE";
1489
        enable_bus_hold       : string  := "NONE";
1490
        weak_pull_up_resistor : string  := "NONE";
1491
        termination           : string  := "NONE";
1492
        lpm_type              : string := "alt_outbuf_tri_diff" );
1493
    port(
1494
        i    : in  std_logic;
1495
        oe   : in  std_logic;
1496
        o    : out   std_logic;
1497
        obar : out std_logic);
1498
end alt_outbuf_tri_diff;
1499
architecture BEHAVIOR of alt_outbuf_tri_diff is
1500
begin
1501
    o <= i when oe = '1'
1502
        else 'Z' when oe = '0'
1503
        else 'X';
1504
    obar <= (not i) when oe = '1'
1505
        else 'Z' when oe = '0'
1506
        else 'X';
1507
end BEHAVIOR;
1508
 
1509
Library ieee;
1510
use ieee.std_logic_1164.all;
1511
entity alt_iobuf_diff is
1512
    generic(
1513
        io_standard           : string  := "NONE";
1514
        current_strength      : string  := "NONE";
1515
        current_strength_new  : string  := "NONE";
1516
        slew_rate             : integer := -1;
1517
        location              : string  := "NONE";
1518
        enable_bus_hold       : string  := "NONE";
1519
        weak_pull_up_resistor : string  := "NONE";
1520
        termination           : string  := "NONE";
1521
        input_termination     : string  := "NONE";
1522
        output_termination    : string  := "NONE";
1523
        lpm_type              : string := "alt_iobuf_diff" );
1524
    port(
1525
        i     : in    std_logic;
1526
        oe    : in    std_logic;
1527
        io    : inout std_logic;
1528
        iobar : inout std_logic;
1529
        o     : out   std_logic);
1530
end alt_iobuf_diff;
1531
architecture BEHAVIOR of alt_iobuf_diff is
1532
begin
1533
 
1534
    process(i, io, iobar, oe)
1535
    variable in_tmp  : std_logic_vector(1 downto 0);
1536
    variable out_tmp : std_logic;
1537
    begin
1538
        in_tmp(0) := iobar;
1539
        in_tmp(1) := io;
1540
        case in_tmp is
1541
            when "00" => out_tmp := 'X';
1542
            when "01" => out_tmp := '0';
1543
            when "10" => out_tmp := '1';
1544
            when "11" => out_tmp := 'X';
1545
            when others => out_tmp := 'X';
1546
        end case;
1547
 
1548
        if oe = '1' then
1549
            io    <= i;
1550
            iobar <= not i;
1551
        elsif oe = '0' then
1552
            io    <= 'Z';
1553
            iobar <= 'Z';
1554
        else
1555
            io    <= 'X';
1556
            iobar <= 'X';
1557
        end if;
1558
 
1559
        o <= out_tmp;
1560
    end process;
1561
end BEHAVIOR;
1562
 
1563
Library ieee;
1564
use ieee.std_logic_1164.all;
1565
entity alt_bidir_diff is
1566
    generic(
1567
        io_standard           : string  := "NONE";
1568
        current_strength      : string  := "NONE";
1569
        current_strength_new  : string  := "NONE";
1570
        slew_rate             : integer := -1;
1571
        location              : string  := "NONE";
1572
        enable_bus_hold       : string  := "NONE";
1573
        weak_pull_up_resistor : string  := "NONE";
1574
        termination           : string  := "NONE";
1575
        input_termination     : string  := "NONE";
1576
        output_termination    : string  := "NONE";
1577
        lpm_type              : string := "alt_bidir_diff" );
1578
    port(
1579
        oe      : in    std_logic;
1580
        bidirin : inout std_logic;
1581
        io      : inout std_logic;
1582
        iobar   : inout std_logic);
1583
end alt_bidir_diff;
1584
architecture BEHAVIOR of alt_bidir_diff is
1585
begin
1586
 
1587
    process(bidirin, io, iobar, oe)
1588
    variable in_tmp  : std_logic_vector(1 downto 0);
1589
    variable out_tmp : std_logic;
1590
    begin
1591
        in_tmp(0) := iobar;
1592
        in_tmp(1) := io;
1593
        case in_tmp is
1594
            when "00" => out_tmp := 'X';
1595
            when "01" => out_tmp := '0';
1596
            when "10" => out_tmp := '1';
1597
            when "11" => out_tmp := 'X';
1598
            when others => out_tmp := 'X';
1599
        end case;
1600
 
1601
        if oe = '1' then
1602
            io   <= bidirin;
1603
            iobar <= not bidirin;
1604
            bidirin <= 'Z';
1605
        elsif oe = '0' then
1606
            io   <= 'Z';
1607
            iobar <= 'Z';
1608
            bidirin <= out_tmp;
1609
        else
1610
            io   <= 'X';
1611
            iobar <= 'X';
1612
            bidirin <= 'X';
1613
        end if;
1614
    end process;
1615
end BEHAVIOR;
1616
 
1617
Library ieee;
1618
use ieee.std_logic_1164.all;
1619
entity alt_bidir_buf is
1620
    generic(
1621
        io_standard           : string  := "NONE";
1622
        current_strength      : string  := "NONE";
1623
        current_strength_new  : string  := "NONE";
1624
        slew_rate             : integer := -1;
1625
        location              : string  := "NONE";
1626
        enable_bus_hold       : string  := "NONE";
1627
        weak_pull_up_resistor : string  := "NONE";
1628
        termination           : string  := "NONE";
1629
        input_termination     : string  := "NONE";
1630
        output_termination    : string  := "NONE";
1631
        lpm_type              : string := "alt_bidir_buf" );
1632
    port(
1633
        oe      : in    std_logic;
1634
        bidirin : inout std_logic;
1635
        io      : inout std_logic);
1636
end alt_bidir_buf;
1637
architecture BEHAVIOR of alt_bidir_buf is
1638
begin
1639
 
1640
    process(bidirin, io, oe)
1641
    variable in_tmp  : std_logic;
1642
    variable out_tmp : std_logic;
1643
    begin
1644
        in_tmp := io;
1645
        case in_tmp is
1646
            when '0' => out_tmp := '0';
1647
            when '1' => out_tmp := '1';
1648
            when others => out_tmp := 'X';
1649
        end case;
1650
 
1651
        if oe = '1' then
1652
            io   <= bidirin;
1653
            bidirin <= 'Z';
1654
        elsif oe = '0' then
1655
            io   <= 'Z';
1656
            bidirin <= out_tmp;
1657
        else
1658
            io   <= 'X';
1659
            bidirin <= 'X';
1660
        end if;
1661
    end process;
1662
end BEHAVIOR;
1663
 

powered by: WebSVN 2.1.0

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