OpenCores
URL https://opencores.org/ocsvn/lzrw1-compressor-core/lzrw1-compressor-core/trunk

Subversion Repositories lzrw1-compressor-core

[/] [lzrw1-compressor-core/] [trunk/] [hw/] [testbench/] [outputEncoderTb.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 habicht
--/**************************************************************************************************************
2
--*
3
--*    L Z R W 1   E N C O D E R   C O R E
4
--*
5
--*  A high throughput loss less data compression core.
6
--* 
7
--* Copyright 2012-2013   Lukas Schrittwieser (LS)
8
--*
9
--*    This program is free software: you can redistribute it and/or modify
10
--*    it under the terms of the GNU General Public License as published by
11
--*    the Free Software Foundation, either version 2 of the License, or
12
--*    (at your option) any later version.
13
--*
14
--*    This program is distributed in the hope that it will be useful,
15
--*    but WITHOUT ANY WARRANTY; without even the implied warranty of
16
--*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
--*    GNU General Public License for more details.
18
--*
19
--*    You should have received a copy of the GNU General Public License
20
--*    along with this program; if not, write to the Free Software
21
--*    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22
--*    Or see <http://www.gnu.org/licenses/>
23
--*
24
--***************************************************************************************************************
25
--*
26
--* Change Log:
27
--*
28
--* Version 1.0 - 2012/7/8 - LS
29
--*   started file
30
--*
31
--* Version 1.0 - 2013/04/05 - LS
32
--*   release
33
--*
34
--***************************************************************************************************************
35
--*
36
--* Naming convention:  http://dz.ee.ethz.ch/en/information/hdl-help/vhdl-naming-conventions.html
37
--*
38
--***************************************************************************************************************
39
--*
40
--* This is the test bench for outputEncoder.vhd
41
--*
42
--***************************************************************************************************************
43
 
44
library ieee;
45
use ieee.std_logic_1164.all;
46
 
47
-------------------------------------------------------------------------------
48
 
49
entity outputEncoder_tb is
50
 
51
end outputEncoder_tb;
52
 
53
-------------------------------------------------------------------------------
54
 
55
architecture Tb of outputEncoder_tb is
56
 
57
  component outputEncoder
58
    generic (
59
      frameSize   : integer;
60
      minMatchLen : integer;
61
      maxMatchLen : integer);
62
    port (
63
      ClkxCI          : in  std_logic;
64
      RstxRI          : in  std_logic;
65
      OffsetxDI       : in  std_logic_vector(11 downto 0);
66
      MatchLengthxDI  : in  integer range 0 to maxMatchLen;
67
      EnxSI           : in  std_logic;
68
      EndOfDataxSI    : in  std_logic;
69
      LiteralxDI      : in  std_logic_vector(7 downto 0);
70
      BodyStrobexSO   : out std_logic;  -- strobe signal: is assert when a new item is available
71
      BodyOutxDO      : out std_logic_vector(7 downto 0);  -- encoded data output
72
      HeaderStrobexSO : out std_logic;
73
      HeaderOutxDO    : out std_logic_vector(frameSize-1 downto 0);
74
      DonexSO         : out std_logic);
75
  end component;
76
 
77
  -- component generics
78
  constant frameSize   : integer := 8;
79
  constant minMatchLen : integer := 3;
80
  constant maxMatchLen : integer := 16;
81
 
82
  -- component ports
83
  signal ClkxCI          : std_logic;
84
  signal RstxRI          : std_logic                      := '1';
85
  signal OffsetxDI       : std_logic_vector(11 downto 0)  := (others => '0');
86
  signal MatchLengthxDI  : integer range 0 to maxMatchLen := 0;
87
  signal EnxSI           : std_logic                      := '0';
88
  signal EndOfDataxSI    : std_logic                      := '0';
89
  signal LiteralxDI      : std_logic_vector(7 downto 0)   := x"00";
90
--  signal EncHeaderOutxDO   : std_logic_vector(frameSize-1 downto 0);
91
--  signal EncBodyOutputxDO  : std_logic_vector(frameSize*8-1 downto 0);
92
--  signal EncOutputValidxSO : std_logic;
93
  signal BodyStrobexSO   : std_logic;  -- strobe signal: is assert when a new item is available
94
  signal BodyOutxDO      : std_logic_vector(7 downto 0);  -- encoded data output
95
  signal HeaderStrobexSO : std_logic;
96
  signal HeaderOutxDO    : std_logic_vector(frameSize-1 downto 0);
97
  signal DonexSO         : std_logic;
98
  -- clock
99
  signal Clk             : std_logic                      := '1';
100
 
101
begin  -- Tb
102
 
103
  -- component instantiation
104
  DUT : outputEncoder
105
    generic map (
106
      frameSize   => frameSize,
107
      minMatchLen => minMatchLen,
108
      maxMatchLen => maxMatchLen)
109
    port map (
110
      ClkxCI          => ClkxCI,
111
      RstxRI          => RstxRI,
112
      OffsetxDI       => OffsetxDI,
113
      MatchLengthxDI  => MatchLengthxDI,
114
      EnxSI           => EnxSI,
115
      EndOfDataxSI    => EndOfDataxSI,
116
      LiteralxDI      => LiteralxDI,
117
      BodyStrobexSO   => BodyStrobexSO,
118
      BodyOutxDO      => BodyOutxDO,
119
      HeaderStrobexSO => HeaderStrobexSO,
120
      HeaderOutxDO    => HeaderOutxDO,
121
      DonexSO         => DonexSO);
122
 
123
  -- clock generation
124
  Clk    <= not Clk after 10 ns;
125
  ClkxCI <= Clk;
126
 
127
  -- waveform generation
128
  WaveGen_Proc : process
129
  begin
130
    wait until Clk'event and Clk = '1';
131
    wait until Clk'event and Clk = '1';
132
    RstxRI         <= '0';
133
    MatchLengthxDI <= 3;
134
    OffsetxDI      <= x"00a";
135
    EnxSI          <= '1';
136
    wait until Clk'event and Clk = '1';
137
    MatchLengthxDI <= 0;                -- will be suppressed
138
    LiteralxDI     <= x"11";
139
    wait until Clk'event and Clk = '1';
140
    MatchLengthxDI <= 0;                -- will be suppressed
141
    OffsetxDI      <= x"222";
142
    LiteralxDI     <= x"22";
143
    wait until Clk'event and Clk = '1';
144
 
145
 
146
    MatchLengthxDI <= 2;
147
    LiteralxDI     <= x"11";
148
    OffsetxDI      <= x"fff";
149
    EnxSI          <= '1';
150
    wait until Clk'event and Clk = '1';
151
 
152
    MatchLengthxDI <= 4;
153
    OffsetxDI      <= x"010";
154
    EnxSI          <= '1';
155
    wait until Clk'event and Clk = '1';
156
    MatchLengthxDI <= 0;                -- will be suppressed
157
    LiteralxDI     <= x"11";
158
    wait until Clk'event and Clk = '1';
159
    MatchLengthxDI <= 0;                -- will be suppressed
160
    OffsetxDI      <= x"222";
161
    LiteralxDI     <= x"22";
162
    wait until Clk'event and Clk = '1';
163
    MatchLengthxDI <= 5;                -- will be suppressed
164
    LiteralxDI     <= x"33";
165
    wait until Clk'event and Clk = '1';
166
 
167
 
168
    EnxSI <= '0';
169
    wait until Clk'event and Clk = '1';
170
 
171
    MatchLengthxDI <= 0;
172
    LiteralxDI     <= x"ab";
173
    OffsetxDI      <= x"000";
174
    EnxSI          <= '1';
175
    wait until Clk'event and Clk = '1';
176
 
177
    EnxSI <= '0';
178
    wait until Clk'event and Clk = '1';
179
 
180
    MatchLengthxDI <= 1;
181
    LiteralxDI     <= x"cd";
182
    OffsetxDI      <= x"00a";
183
    EnxSI          <= '1';
184
    wait until Clk'event and Clk = '1';
185
 
186
    EnxSI <= '0';
187
    wait until Clk'event and Clk = '1';
188
 
189
    MatchLengthxDI <= 4;
190
    OffsetxDI      <= x"123";
191
    EnxSI          <= '1';
192
    wait until Clk'event and Clk = '1';
193
    MatchLengthxDI <= 0;                -- will be suppressed
194
    LiteralxDI     <= x"11";
195
    wait until Clk'event and Clk = '1';
196
    MatchLengthxDI <= 0;                -- will be suppressed
197
    OffsetxDI      <= x"222";
198
    LiteralxDI     <= x"22";
199
    wait until Clk'event and Clk = '1';
200
    MatchLengthxDI <= 5;                -- will be suppressed
201
    LiteralxDI     <= x"33";
202
    wait until Clk'event and Clk = '1';
203
 
204
    MatchLengthxDI <= 3;
205
    OffsetxDI      <= x"aaa";
206
    EnxSI          <= '1';
207
    wait until Clk'event and Clk = '1';
208
    MatchLengthxDI <= 0;                -- will be suppressed
209
    LiteralxDI     <= x"11";
210
    wait until Clk'event and Clk = '1';
211
    MatchLengthxDI <= 0;                -- will be suppressed
212
    OffsetxDI      <= x"222";
213
    LiteralxDI     <= x"22";
214
    wait until Clk'event and Clk = '1';
215
 
216
    EnxSI <= '0';
217
    wait until Clk'event and Clk = '1';
218
 
219
    MatchLengthxDI <= 1;
220
    LiteralxDI     <= x"ef";
221
    OffsetxDI      <= x"00a";
222
    EnxSI          <= '1';
223
    wait until Clk'event and Clk = '1';
224
 
225
    EnxSI <= '0';
226
    wait until Clk'event and Clk = '1';
227
 
228
    MatchLengthxDI <= 1;
229
    LiteralxDI     <= x"00";
230
    OffsetxDI      <= x"00a";
231
    EnxSI          <= '1';
232
    wait until Clk'event and Clk = '1';
233
 
234
 
235
    EnxSI        <= '0';
236
    EndOfDataxSI <= '1';
237
    wait until Clk'event and Clk = '1';
238
 
239
    EndOfDataxSI <= '0';
240
    EnxSI        <= '0';
241
    wait;
242
 
243
  end process WaveGen_Proc;
244
 
245
 
246
 
247
end Tb;
248
 
249
-------------------------------------------------------------------------------
250
 
251
configuration outputEncoder_tb_Tb_cfg of outputEncoder_tb is
252
  for Tb
253
  end for;
254
end outputEncoder_tb_Tb_cfg;
255
 
256
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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