1 |
3 |
mgeng |
----------------------------------------------------------------------
|
2 |
|
|
---- ----
|
3 |
|
|
---- Package used by the test pattern generator for the ----
|
4 |
|
|
---- Synchronous static RAM ("Zero Bus Turnaround" RAM, ZBT RAM) ----
|
5 |
|
|
---- simulation model. ----
|
6 |
|
|
---- ----
|
7 |
|
|
---- This file is part of the simu_mem project. ----
|
8 |
|
|
---- ----
|
9 |
|
|
---- Authors: ----
|
10 |
|
|
---- - Michael Geng, vhdl@MichaelGeng.de ----
|
11 |
|
|
---- ----
|
12 |
|
|
----------------------------------------------------------------------
|
13 |
|
|
---- ----
|
14 |
|
|
---- Copyright (C) 2008 Authors ----
|
15 |
|
|
---- ----
|
16 |
|
|
---- This source file may be used and distributed without ----
|
17 |
|
|
---- restriction provided that this copyright statement is not ----
|
18 |
|
|
---- removed from the file and that any derivative work contains ----
|
19 |
|
|
---- the original copyright notice and the associated disclaimer. ----
|
20 |
|
|
---- ----
|
21 |
|
|
---- This source file is free software; you can redistribute it ----
|
22 |
|
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
23 |
|
|
---- Public License as published by the Free Software Foundation; ----
|
24 |
|
|
---- either version 2.1 of the License, or (at your option) any ----
|
25 |
|
|
---- later version. ----
|
26 |
|
|
---- ----
|
27 |
|
|
---- This source is distributed in the hope that it will be ----
|
28 |
|
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
29 |
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
30 |
|
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
31 |
|
|
---- details. ----
|
32 |
|
|
---- ----
|
33 |
|
|
---- You should have received a copy of the GNU Lesser General ----
|
34 |
|
|
---- Public License along with this source; if not, download it ----
|
35 |
|
|
---- from http://www.gnu.org/licenses/lgpl.html ----
|
36 |
|
|
---- ----
|
37 |
|
|
----------------------------------------------------------------------
|
38 |
|
|
-- CVS Revision History
|
39 |
|
|
--
|
40 |
|
|
-- $Log: not supported by cvs2svn $
|
41 |
|
|
--
|
42 |
|
|
LIBRARY ieee, misc;
|
43 |
|
|
USE ieee.std_logic_1164.ALL;
|
44 |
|
|
USE ieee.numeric_std.ALL;
|
45 |
|
|
USE misc.math_pkg.ALL;
|
46 |
|
|
|
47 |
|
|
PACKAGE patgen_pkg IS
|
48 |
|
|
COMPONENT patgen IS
|
49 |
|
|
GENERIC (
|
50 |
|
|
clk_periode : TIME);
|
51 |
|
|
port (
|
52 |
|
|
Clk : IN STD_LOGIC;
|
53 |
|
|
Rst : IN STD_LOGIC;
|
54 |
|
|
Ena : IN STD_LOGIC;
|
55 |
|
|
A : OUT STD_LOGIC_VECTOR;
|
56 |
|
|
D : OUT STD_LOGIC_VECTOR;
|
57 |
|
|
CKE_n : OUT STD_LOGIC;
|
58 |
|
|
CS1_n : OUT STD_LOGIC;
|
59 |
|
|
CS2 : OUT STD_LOGIC;
|
60 |
|
|
CS2_n : OUT STD_LOGIC;
|
61 |
|
|
WE_n : OUT STD_LOGIC;
|
62 |
|
|
BW_n : OUT STD_LOGIC_VECTOR;
|
63 |
|
|
OE_n : OUT STD_LOGIC;
|
64 |
|
|
ADV : OUT STD_LOGIC;
|
65 |
|
|
ZZ : OUT STD_LOGIC;
|
66 |
|
|
LBO_n : OUT STD_LOGIC);
|
67 |
|
|
END COMPONENT patgen;
|
68 |
|
|
|
69 |
|
|
PROCEDURE random_vector (
|
70 |
|
|
SIGNAL D : OUT STD_LOGIC_VECTOR;
|
71 |
|
|
VARIABLE random : INOUT NATURAL);
|
72 |
|
|
END PACKAGE patgen_pkg;
|
73 |
|
|
|
74 |
|
|
PACKAGE BODY patgen_pkg IS
|
75 |
|
|
PROCEDURE random_vector (
|
76 |
|
|
SIGNAL D : OUT STD_LOGIC_VECTOR;
|
77 |
|
|
VARIABLE random : INOUT NATURAL) IS
|
78 |
|
|
BEGIN
|
79 |
|
|
IF (D'length >= 31) THEN
|
80 |
|
|
random := lcg (random);
|
81 |
|
|
D (30 DOWNTO 0) <= STD_LOGIC_VECTOR (TO_UNSIGNED (random, 32)(30 DOWNTO 0));
|
82 |
|
|
|
83 |
|
|
random := lcg (random);
|
84 |
|
|
D (D'length - 1 DOWNTO 31) <=
|
85 |
|
|
STD_LOGIC_VECTOR (TO_UNSIGNED (random, 32)(D'length - 32 DOWNTO 0));
|
86 |
|
|
else
|
87 |
|
|
random := lcg (random);
|
88 |
|
|
D <= STD_LOGIC_VECTOR (TO_UNSIGNED (random, 32)(D'length - 1 DOWNTO 0));
|
89 |
|
|
END IF;
|
90 |
|
|
END PROCEDURE random_vector;
|
91 |
|
|
END PACKAGE BODY patgen_pkg;
|