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

Subversion Repositories open_hitter

[/] [open_hitter/] [trunk/] [bench/] [vhdl/] [parse_price_wrapper.vhd] - Blame information for rev 13

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

Line No. Rev Author Line
1 3 stvhawes
--////////////////////////////////////////////////////////////////////
2
--//                                                              ////
3
--// parse_price_wrapper.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
--// Single module development: parse_price.vhd                   ////
11
--// target env: ghdl <attrib required>                           ////        
12
--//                                                              ////
13
--// To Do:                                                       ////
14
--//    #LOTS                                                     ////
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 std.textio.all; --  Imports the standard textio package.
55
-- use ieee.std_logic_textio.all;
56
 
57
     entity parse_price_wrapper is
58
     end parse_price_wrapper;
59
 
60
     architecture behaviour of parse_price_wrapper is
61
        component parse_price
62
           port (
63 7 stvhawes
               RX_CLK: in std_logic;
64 3 stvhawes
               in_byte: in std_logic_vector(7 downto 0);
65
               byte_reset: in std_logic;
66
               byte_ready: in std_logic;
67
               price_ready: out std_logic;
68
               -- pxdata: out price_packet
69
                  px_type: out std_logic_vector(4 downto 0);
70
                  buy_sell: out std_logic_vector(2 downto 0);   -- 111 buy, 000 sell
71
                  px: out std_logic_vector(15 downto 0);     -- price
72
                  qty: out std_logic_vector(15 downto 0);    -- quantity
73
                  sec: out std_logic_vector(55 downto 0);    -- 7x 8bits securities identifier
74
                  id: out std_logic_vector(15 downto 0)     -- unique/identifier/counter
75
           );
76
        end component;
77
        for parse_price_0: parse_price use entity work.parse_price;
78 7 stvhawes
               signal RX_CLK: std_logic;
79 3 stvhawes
               signal in_byte: std_logic_vector(7 downto 0);
80
               signal byte_reset: std_logic;
81
               signal byte_ready: std_logic;
82
               signal price_ready: std_logic;
83
               -- pxdata: price_packet
84
                  signal px_type: std_logic_vector(4 downto 0);
85
                  signal buy_sell: std_logic_vector(2 downto 0);   -- 111 buy, 000 sell
86
                  signal px: std_logic_vector(15 downto 0);     -- price
87
                  signal qty: std_logic_vector(15 downto 0);    -- quantity
88
                  signal sec: std_logic_vector(55 downto 0);    -- 7x 8bits securities identifier
89
                  signal id: std_logic_vector(15 downto 0);     -- unique/identifier/counter
90
     begin
91
        parse_price_0: parse_price port map (
92 7 stvhawes
               RX_CLK => RX_CLK,
93 3 stvhawes
               in_byte => in_byte,
94
               byte_reset => byte_reset,
95
               byte_ready => byte_ready,
96
               price_ready => price_ready,
97
               -- price_packet
98
                  px_type => px_type,
99
                  buy_sell => buy_sell,
100
                  px => px,
101
                  qty => qty,
102
                  sec => sec,
103
                  id => id
104
               );
105
        process
106
           variable l : line;
107
           --                                                          WWHHAATTSSEECC
108 7 stvhawes
           constant pkt : std_logic_vector(111 downto 0) := X"081234567857484154534543C078";
109 3 stvhawes
           variable pos : integer;
110
           variable offset : integer;
111
           variable eoffset : integer;
112
        begin
113
           write (l, String'("Exercising parse_price"));
114
           writeline (output, l);
115
 
116 7 stvhawes
              byte_reset <= '1';
117 3 stvhawes
              byte_ready <= '0';
118 7 stvhawes
              RX_CLK <= '0';
119 3 stvhawes
              wait for 1 ns;
120 7 stvhawes
              RX_CLK <= '1';
121 3 stvhawes
              wait for 1 ns;
122 7 stvhawes
              RX_CLK <= '0';
123 3 stvhawes
              wait for 1 ns;
124
 
125 7 stvhawes
              for pos in 13 downto 0 loop
126 3 stvhawes
                 in_byte <= pkt(8*pos+7 downto 8*pos);
127
                 byte_ready <= '1';
128 7 stvhawes
                 byte_reset <= '0';
129
                 RX_CLK <= '1';
130 3 stvhawes
                 wait for 1 ns;
131
 
132
                 for i in in_byte'range loop
133
                    write(l, std_logic'image(in_byte(i)) );
134
                 end loop;
135
 
136
                 write(l, String'(" px_type:"));
137
                 for i in px_type'range loop
138
                    write(l, std_logic'image(px_type(i)) );
139
                 end loop;
140
 
141
                 write(l, String'(" buy_sell:"));
142
                 for i in buy_sell'range loop
143
                    write(l, std_logic'image(buy_sell(i)) );
144
                 end loop;
145
 
146
                 write(l, String'(" px:"));
147
                 for i in px'range loop
148
                    write(l, std_logic'image(px(i)) );
149
                 end loop;
150
 
151
                 write(l, String'(" qty:"));
152
                 for i in qty'range loop
153
                    write(l, std_logic'image(qty(i)) );
154
                 end loop;
155
 
156
                 write(l, String'(" sec:"));
157
                 for i in sec'range loop
158
                    write(l, std_logic'image(sec(i)) );
159
                 end loop;
160
 
161
                 write(l, String'(" id:"));
162
                 for i in id'range loop
163
                    write(l, std_logic'image(id(i)) );
164
                 end loop;
165
 
166
                 writeline(output, l);
167
 
168 7 stvhawes
                 RX_CLK <= '0';
169 3 stvhawes
                 wait for 1 ns;
170
              end loop;
171
 
172
           write (l, String'("Done parse_price"));
173
           writeline (output, l);
174 7 stvhawes
                                                                                   --  081234 5678 574841545345 43C0
175
           if (px_type = B"00001") and (buy_sell = B"000") and (px = B"00010010_00110100")  -- 081234
176
              and (qty = B"01010110_01111000")                                              -- 5678  
177
              and (sec = B"01010111_01001000_01000001_01010100_01010011_01000101_01000011") -- 57484154534543
178
              and (id  = B"11000000_01111000")                                              -- C078
179 3 stvhawes
           then
180
               write (l, String'("... and Price is OK."));
181
               writeline (output, l);
182 7 stvhawes
           else
183
               write (l, String'("... and price check failed."));
184
               writeline (output, l);
185 3 stvhawes
           end if;
186
 
187
           wait;
188
        end process;
189
     end behaviour;

powered by: WebSVN 2.1.0

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