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

Subversion Repositories open_hitter

[/] [open_hitter/] [trunk/] [bench/] [vhdl/] [search_item_wrapper.vhd] - Blame information for rev 12

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 stvhawes
--////////////////////////////////////////////////////////////////////
2
--//                                                              ////
3
--// search_item.vhd                                              ////
4
--//                                                              ////
5
--// This file is part of the open_hitter opencores effort.       ////
6
--// <http://www.opencores.org/cores/open_hitter/>                ////
7
--//                                                              ////
8
--// Module Description:                                          ////
9
--// Simulation program (non-synthesizable)                       ////
10
--// Drives auto regression tests via NSEW button actions and     ////
11
--// NSEW LED reporting                                           ////
12
--// target env: ghdl <attrib required>                           ////
13
--//                                                              ////
14
--// To Do:                                                       ////
15
--//                                                              ////
16
--// Author(s):                                                   ////
17
--// - Stephen Hawes                                              ////
18
--//                                                              ////
19
--////////////////////////////////////////////////////////////////////
20
--//                                                              ////
21
--// Copyright (C) 2015 Stephen Hawes and OPENCORES.ORG           ////
22
--//                                                              ////
23
--// This source file may be used and distributed without         ////
24
--// restriction provided that this copyright statement is not    ////
25
--// removed from the file and that any derivative work contains  ////
26
--// the original copyright notice and the associated disclaimer. ////
27
--//                                                              ////
28
--// This source file is free software; you can redistribute it   ////
29
--// and/or modify it under the terms of the GNU Lesser General   ////
30
--// Public License as published by the Free Software Foundation; ////
31
--// either version 2.1 of the License, or (at your option) any   ////
32
--// later version.                                               ////
33
--//                                                              ////
34
--// This source is distributed in the hope that it will be       ////
35
--// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
36
--// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
37
--// PURPOSE. See the GNU Lesser General Public License for more  ////
38
--// details.                                                     ////
39
--//                                                              ////
40
--// You should have received a copy of the GNU Lesser General    ////
41
--// Public License along with this source; if not, download it   ////
42
--// from <http://www.opencores.org/lgpl.shtml>                   ////
43
--//                                                              ////
44
--////////////////////////////////////////////////////////////////////
45
--//
46
--// \$Id\$  TAKE OUT THE \'s and this comment in order to get this to work
47
--//
48
--// CVS Revision History
49
--//
50
--// \$Log\$  TAKE OUT THE \'s and this comment in order to get this to work
51
--//
52
library ieee;
53
use ieee.std_logic_1164.all;
54
use ieee.numeric_std.ALL;
55
use std.textio.all; --  Imports the standard textio package.
56
 
57
entity search_item_wrapper is
58
end search_item_wrapper;
59
 
60
architecture behaviour of search_item_wrapper is
61
   component search_item
62
   port (
63
        RX_CLK: in std_logic;
64
        -- control flag(s) on the incoming bus
65
           b1_px_valid: in std_logic;
66
        -- pxdata: in price_packet
67
           b1_px_type: in std_logic_vector(4 downto 0);
68
           b1_buy_sell: in std_logic_vector(2 downto 0);   -- 111 buy, 000 sell
69
           b1_px: in std_logic_vector(15 downto 0);     -- price
70
           b1_qty: in std_logic_vector(15 downto 0);    -- quantity
71
           b1_sec: in std_logic_vector(55 downto 0);    -- 7x 8bits securities identifier
72
           b1_id: in std_logic_vector(15 downto 0);    -- unique/identifier/counter
73
        -- pxdata: out price_packet
74
           b2_px_type: out std_logic_vector(4 downto 0);
75
           b2_buy_sell: out std_logic_vector(2 downto 0);   -- 111 buy, 000 sell
76
           b2_px: out std_logic_vector(15 downto 0);     -- price
77
           b2_qty: out std_logic_vector(15 downto 0);    -- quantity
78
           b2_sec: out std_logic_vector(55 downto 0);    -- 7x 8bits securities identifier
79
           b2_id: out std_logic_vector(15 downto 0)      -- unique/identifier/counter
80
   );
81
   end component;
82
   for search_item_0: search_item use entity work.search_item;
83
        signal RX_CLK: std_logic;
84
        -- control flag(s) on the incoming bus
85
           signal b1_px_valid: std_logic;
86
        -- pxdata: in price_packet
87
           signal b1_px_type: std_logic_vector(4 downto 0);
88
           signal b1_buy_sell: std_logic_vector(2 downto 0);   -- 111 buy, 000 sell
89
           signal b1_px: std_logic_vector(15 downto 0);     -- price
90
           signal b1_qty: std_logic_vector(15 downto 0);    -- quantity
91
           signal b1_sec: std_logic_vector(55 downto 0);    -- 7x 8bits securities identifier
92
           signal b1_id: std_logic_vector(15 downto 0);    -- unique/identifier/counter
93
        -- pxdata: out price_packet
94
           signal b2_px_type: std_logic_vector(4 downto 0);
95
           signal b2_buy_sell: std_logic_vector(2 downto 0);   -- 111 buy, 000 sell
96
           signal b2_px: std_logic_vector(15 downto 0);     -- price
97
           signal b2_qty: std_logic_vector(15 downto 0);    -- quantity
98
           signal b2_sec: std_logic_vector(55 downto 0);    -- 7x 8bits securities identifier
99
           signal b2_id: std_logic_vector(15 downto 0);     -- unique/identifier/counter
100
   begin
101
        search_item_0: search_item port map (
102
           RX_CLK => RX_CLK,
103
           -- control flag(s) on the incoming bus
104
              b1_px_valid => b1_px_valid,
105
           -- pxdata: in price_packet
106
              b1_px_type => b1_px_type,
107
              b1_buy_sell => b1_buy_sell,
108
              b1_px => b1_px,
109
              b1_qty => b1_qty,
110
              b1_sec => b1_sec,
111
              b1_id => b1_id,
112
           -- pxdata: out price_packet
113
              b2_px_type => b2_px_type,
114
              b2_buy_sell => b2_buy_sell,
115
              b2_px => b2_px,
116
              b2_qty => b2_qty,
117
              b2_sec => b2_sec,
118
              b2_id => b2_id
119
           );
120
   process
121
        variable l : line;
122
 
123
        type input_pattern_type is record
124
           -- control flag(s) on the incoming bus
125
              b1_px_valid: std_logic;
126
           -- pxdata: in price_packet
127
              b1_px_type: std_logic_vector(4 downto 0);
128
              b1_buy_sell: std_logic_vector(2 downto 0);   -- 111 buy, 000 sell
129
              b1_px: std_logic_vector(15 downto 0);     -- price
130
              b1_qty: std_logic_vector(15 downto 0);    -- quantity
131
              b1_sec: std_logic_vector(55 downto 0);    -- 7x 8bits securities identifier
132
              b1_id: std_logic_vector(15 downto 0);    -- unique/identifier/counter
133
         end record;
134
         type output_pattern_type is record
135
            -- pxdata: out price_packet
136
              b2_px_type: std_logic_vector(4 downto 0);
137
              b2_buy_sell: std_logic_vector(2 downto 0);   -- 111 buy, 000 sell
138
              b2_px: std_logic_vector(15 downto 0);     -- price
139
              b2_qty: std_logic_vector(15 downto 0);    -- quantity
140
              b2_sec: std_logic_vector(55 downto 0);    -- 7x 8bits securities identifier
141
              b2_id: std_logic_vector(15 downto 0);      -- unique/identifier/counter
142
         end record;
143
 
144
         --  The patterns to apply.
145
         constant px1: std_logic_vector(15 downto 0) := (others => 'Z');
146
         constant qty1: std_logic_vector(15 downto 0) := (others => 'Z');
147
         constant sec1: std_logic_vector(55 downto 0) := (others => 'Z');
148
         constant id1: std_logic_vector(15 downto 0) := (others => 'Z');
149
         type input_pattern_array is array (natural range <>) of input_pattern_type;
150
--           constant input_patterns : input_pattern_array :=
151
--             ( ('0', std_logic_vector'("ZZZZ"), std_logic_vector'("ZZZ"), px1, qty1, sec1, id1),
152
--               ('0', std_logic_vector'("ZZZZ"), std_logic_vector'("ZZZ"), px1, qty1, sec1, id1) );
153
         type output_pattern_array is array (natural range <>) of output_pattern_type;
154
--           constant output_patterns : output_pattern_array :=
155
--             ( (std_logic_vector'("ZZZZ"), std_logic_vector'("ZZZ"), (others => 'Z'), (others => 'Z'), (others => 'Z'), (others => 'Z')),
156
--               (std_logic_vector'("ZZZZ"), std_logic_vector'("ZZZ"), (others => 'Z'), (others => 'Z'), (others => 'Z'), (others => 'Z')) );
157
 
158
   begin
159
        write (l, String'("Exercising search_item"));
160
        writeline (output, l);
161
 
162
           --  Check each pattern.
163
       --    for i in patterns'range loop
164
              --  Set the inputs.
165
       --       i0 <= patterns(i).i0;
166
       --       i1 <= patterns(i).i1;
167
       --       ci <= patterns(i).ci;
168
              --  Wait for the results.
169
       --       wait for 1 ns;
170
              --  Check the outputs.
171
       --       assert s = patterns(i).s
172
       --          report "bad sum value" severity error;
173
       --       assert co = patterns(i).co
174
      --           report "bad carray out value" severity error;
175
       --    end loop;
176
      --     assert false report "end of test" severity note;
177
           --  Wait forever; this will finish the simulation.
178
      --     wait;
179
 
180
        write (l, String'("Done search_item"));
181
        writeline (output, l);
182
 
183
        wait;
184
        end process;
185
     end behaviour;
186
 

powered by: WebSVN 2.1.0

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