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/] [synplify/] [sim/] [synplify.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimamali
-----------------------------------------------------------------------------
2
--                                                                         --
3
-- Copyright (c) 1997 by Synplicity, Inc.  All rights reserved.            --
4
--                                                                         --
5
-- This source file may be used and distributed without restriction        --
6
-- provided that this copyright statement is not removed from the file     --
7
-- and that any derivative work contains this copyright notice.            --
8
--                                                                         --
9
-- Primitive library for post synthesis simulation                         --
10
-- These models are not intended for efficient synthesis                   --
11
--                                                                         --
12
-----------------------------------------------------------------------------
13
--pragma translate_off
14
library ieee;
15
use ieee.std_logic_1164.all;
16
entity prim_counter is
17
    generic (w : integer := 8);
18
    port (
19
        q : buffer std_logic_vector(w - 1 downto 0);
20
        cout : out std_logic;
21
        d : in std_logic_vector(w - 1 downto 0);
22
        cin : in std_logic;
23
        clk : in std_logic;
24
        rst : in std_logic;
25
        load : in std_logic;
26
        en : in std_logic;
27
        updn : in std_logic
28
    );
29
end prim_counter;
30
 
31
architecture beh of prim_counter is
32
    signal nextq : std_logic_vector(w - 1 downto 0);
33
begin
34
    nxt: process (q, cin, updn)
35
        variable i : integer;
36
        variable nextc, c : std_logic;
37
    begin
38
        nextc := cin;
39
        for i in 0 to w - 1 loop
40
            c := nextc;
41
            nextq(i) <= c xor (not updn) xor q(i);
42
            nextc := (c and (not updn)) or
43
                 (c and q(i)) or
44
                 ((not updn) and q(i));
45
        end loop;
46
        cout <= nextc;
47
    end process;
48
 
49
    ff : process (clk, rst)
50
    begin
51
        if rst = '1' then
52
            q <= (others => '0');
53
        elsif rising_edge(clk) then
54
            q <= nextq;
55
        end if;
56
    end process ff;
57
end beh;
58
 
59
library ieee;
60
use ieee.std_logic_1164.all;
61
entity prim_dff is
62
    port (q : out std_logic;
63
          d : in std_logic;
64
          clk : in std_logic;
65
          r : in std_logic := '0';
66
          s : in std_logic := '0');
67
end prim_dff;
68
 
69
architecture beh of prim_dff is
70
begin
71
    ff : process (clk, r, s)
72
    begin
73
        if r = '1' then
74
            q <= '0';
75
        elsif s = '1' then
76
            q <= '1';
77
        elsif rising_edge(clk) then
78
            q <= d;
79
        end if;
80
    end process ff;
81
end beh;
82
 
83
library ieee;
84
use ieee.std_logic_1164.all;
85
 
86
library ieee;
87
use ieee.std_logic_1164.all;
88
entity prim_sdff is
89
        port (q : out std_logic;
90
                  d : in std_logic;
91
                  c : in std_logic;
92
                  r : in std_logic := '0';
93
                  s : in std_logic := '0');
94
end prim_sdff;
95
 
96
architecture beh of prim_sdff is
97
 
98
begin
99
        ff : process(c)
100
        begin
101
                if rising_edge(c) then
102
                        if r = '1' then
103
                                q <= '0';
104
                        elsif s = '1' then
105
                                q <= '1';
106
                        else
107
                                q <= d;
108
                        end if;
109
                end if;
110
   end process ff;
111
end beh;
112
 
113
 
114
 
115
library ieee;
116
use ieee.std_logic_1164.all;
117
entity prim_latch is
118
    port (q : out std_logic;
119
          d : in std_logic;
120
          clk : in std_logic;
121
          r : in std_logic := '0';
122
          s : in std_logic := '0');
123
end prim_latch;
124
 
125
architecture beh of prim_latch is
126
begin
127
    q <= '0' when r = '1' else
128
         '1' when s = '1' else
129
         d when clk = '1';
130
end beh;
131
 
132
----------------------------------------------------------------------------
133
-- Zero ohm resistors: Hardi's solution to connect two inout ports. 
134
 
135
----------------------------------------------------------------------------
136
-- Copyright (c) 1995, Ben Cohen.   All rights reserved.
137
-- This model can be used in conjunction with the Kluwer Academic book
138
-- "VHDL Coding Styles and Methodologies", ISBN: 0-7923-9598-0
139
-- "VHDL Amswers to Frequently Asked Questions", Kluwer Academic
140
-- which discusses guidelines and testbench design issues.
141
--
142
-- This source file for the ZERO Ohm resistor model may be used and
143
-- distributed without restriction provided that this copyright
144
-- statement is not removed from the file and that any derivative work
145
-- contains this copyright notice.
146
 
147
-- File name  : Zohm_ea.vhd
148
-- Description: This package, entity, and architecture provide
149
--   the definition of a zero ohm component (A, B).
150
--
151
--   The applications of this component include:
152
--     . Normal operation of a jumper wire (data flowing in both directions)
153
--
154
--   The component consists of 2 ports:
155
--      . Port A: One side of the pass-through switch
156
--      . Port B: The other side of the pass-through switch
157
 
158
--   The model is sensitive to transactions on all ports.  Once a
159
--   transaction is detected, all other transactions are ignored
160
--   for that simulation time (i.e. further transactions in that
161
--   delta time are ignored).
162
--
163
--   The width of the pass-through switch is defined through the
164
--   generic "width_g".  The pass-through control and operation
165
--   is defined on a per bit basis (i.e. one process per bit).
166
--
167
-- Model Limitations and Restrictions:
168
--   Signals asserted on the ports of the error injector should not have
169
--   transactions occuring in multiple delta times because the model
170
--   is sensitive to transactions on port A, B ONLY ONCE during
171
--   a simulation time.  Thus, once fired, a process will
172
--   not refire if there are multiple transactions occuring in delta times.
173
--   This condition may occur in gate level simulations with
174
--   ZERO delays because transactions may occur in multiple delta times.
175
--
176
--
177
-- Acknowledgement: The author thanks Steve Schoessow and Johan Sandstrom
178
--   for their contributions and discussions in the enhancement and
179
--   verification of this model.
180
--
181
--=================================================================
182
-- Revisions:
183
--   Date   Author       Revision  Comment
184
-- 07-13-95 Ben Cohen    Rev A     Creation
185
--          VhdlCohen@aol.com
186
-------------------------------------------------------------
187
library IEEE;
188
  use IEEE.Std_Logic_1164.all;
189
 
190
entity ZeroOhm1 is
191
  port
192
    (A : inout Std_Logic;
193
     B : inout Std_Logic
194
     );
195
end ZeroOhm1;
196
 
197
 
198
architecture ZeroOhm1_a of ZeroOhm1 is
199
--    attribute syn_black_box : boolean;
200
--    attribute syn_feedthrough : boolean;
201
--    attribute syn_black_box of all : architecture is true;
202
--    attribute syn_feedthrough of all : architecture is true;
203
begin
204
  ABC0_Lbl: process
205
    variable ThenTime_v : time;
206
  begin
207
 
208
    wait on A'transaction, B'transaction
209
                      until ThenTime_v /= now;
210
 
211
    -- Break
212
    ThenTime_v := now;
213
    A <= 'Z';
214
    B <= 'Z';
215
    wait for 0 ns;
216
    -- Make
217
    A <= B;
218
    B <= A;
219
 
220
  end process ABC0_Lbl;
221
end ZeroOhm1_a;
222
 
223
-------------------------------------------------------------
224
 
225
library ieee;
226
use ieee.std_logic_1164.all;
227
library grlib;
228
use grlib.stdlib.all;
229
 
230
entity prim_ramd is
231
generic (
232
   data_width : integer := 4;
233
    addr_width : integer := 5);
234
port (
235
    dout : out std_logic_vector(data_width-1 downto 0);
236
    aout : in std_logic_vector(addr_width-1 downto 0);
237
    din  : in std_logic_vector(data_width-1 downto 0);
238
    ain : in std_logic_vector(addr_width-1 downto 0);
239
    we   : in std_logic;
240
    clk  : in std_logic);
241
end prim_ramd;
242
 
243
architecture beh of prim_ramd is
244
 
245
constant depth : integer := 2** addr_width;
246
type mem_type is array (depth-1 downto 0) of std_logic_vector (data_width-1 downto 0);
247
signal mem: mem_type;
248
 
249
begin
250
 
251
dout <= mem(conv_integer(aout));
252
 
253
process (clk)
254
    begin
255
        if rising_edge(clk) then
256
            if (we = '1') then
257
                mem(conv_integer(ain)) <= din;
258
            end if;
259
        end if;
260
end process;
261
 
262
end beh ;
263
 
264
 
265
library ieee;
266
use ieee.std_logic_1164.all;
267
package components is
268
    component prim_counter
269
        generic (w : integer);
270
        port (
271
            q : buffer std_logic_vector(w - 1 downto 0);
272
            cout : out std_logic;
273
            d : in std_logic_vector(w - 1 downto 0);
274
            cin : in std_logic;
275
            clk : in std_logic;
276
            rst : in std_logic;
277
            load : in std_logic;
278
            en : in std_logic;
279
            updn : in std_logic
280
        );
281
    end component;
282
    component prim_dff
283
        port (q : out std_logic;
284
              d : in std_logic;
285
              clk : in std_logic;
286
              r : in std_logic := '0';
287
              s : in std_logic := '0');
288
    end component;
289
        component prim_sdff
290
                port(q : out std_logic;
291
                         d : in std_logic;
292
                         c : in std_logic;
293
                         r : in std_logic := '0';
294
                         s : in std_logic := '0');
295
        end component;
296
    component prim_latch
297
        port (q : out std_logic;
298
              d : in std_logic;
299
              clk : in std_logic;
300
              r : in std_logic := '0';
301
              s : in std_logic := '0');
302
    end component;
303
 
304
    component prim_ramd is
305
    generic (
306
        data_width : integer := 4;
307
        addr_width : integer := 5);
308
    port (
309
        dout : out std_logic_vector(data_width-1 downto 0);
310
        aout : in std_logic_vector(addr_width-1 downto 0);
311
        din  : in std_logic_vector(data_width-1 downto 0);
312
        ain : in std_logic_vector(addr_width-1 downto 0);
313
        we   : in std_logic;
314
        clk  : in std_logic);
315
    end component;
316
 
317
end components;
318
-- pragma translate_on

powered by: WebSVN 2.1.0

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