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 3

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
               in_byte: in std_logic_vector(7 downto 0);
64
               byte_reset: in std_logic;
65
               byte_ready: in std_logic;
66
               price_ready: out std_logic;
67
               -- pxdata: out price_packet
68
                  px_type: out std_logic_vector(4 downto 0);
69
                  buy_sell: out std_logic_vector(2 downto 0);   -- 111 buy, 000 sell
70
                  px: out std_logic_vector(15 downto 0);     -- price
71
                  qty: out std_logic_vector(15 downto 0);    -- quantity
72
                  sec: out std_logic_vector(55 downto 0);    -- 7x 8bits securities identifier
73
                  id: out std_logic_vector(15 downto 0)     -- unique/identifier/counter
74
           );
75
        end component;
76
        for parse_price_0: parse_price use entity work.parse_price;
77
               signal in_byte: std_logic_vector(7 downto 0);
78
               signal byte_reset: std_logic;
79
               signal byte_ready: std_logic;
80
               signal price_ready: std_logic;
81
               -- pxdata: price_packet
82
                  signal px_type: std_logic_vector(4 downto 0);
83
                  signal buy_sell: std_logic_vector(2 downto 0);   -- 111 buy, 000 sell
84
                  signal px: std_logic_vector(15 downto 0);     -- price
85
                  signal qty: std_logic_vector(15 downto 0);    -- quantity
86
                  signal sec: std_logic_vector(55 downto 0);    -- 7x 8bits securities identifier
87
                  signal id: std_logic_vector(15 downto 0);     -- unique/identifier/counter
88
     begin
89
        parse_price_0: parse_price port map (
90
               in_byte => in_byte,
91
               byte_reset => byte_reset,
92
               byte_ready => byte_ready,
93
               price_ready => price_ready,
94
               -- price_packet
95
                  px_type => px_type,
96
                  buy_sell => buy_sell,
97
                  px => px,
98
                  qty => qty,
99
                  sec => sec,
100
                  id => id
101
               );
102
        process
103
           variable l : line;
104
           --                                                          WWHHAATTSSEECC
105
           constant pkt : std_logic_vector(103 downto 0) := X"081234567857484154534543C0";
106
           variable pos : integer;
107
           variable offset : integer;
108
           variable eoffset : integer;
109
        begin
110
           write (l, String'("Exercising parse_price"));
111
           writeline (output, l);
112
 
113
              byte_ready <= '0';
114
              wait for 1 ns;
115
              byte_reset <= '1';
116
              byte_ready <= '1';
117
              wait for 1 ns;
118
              byte_ready <= '0';
119
              wait for 1 ns;
120
              byte_reset <= '0';
121
 
122
              for pos in 12 downto 0 loop
123
                 in_byte <= pkt(8*pos+7 downto 8*pos);
124
                 byte_ready <= '1';
125
                 wait for 1 ns;
126
 
127
                 for i in in_byte'range loop
128
                    write(l, std_logic'image(in_byte(i)) );
129
                 end loop;
130
 
131
                 write(l, String'(" px_type:"));
132
                 for i in px_type'range loop
133
                    write(l, std_logic'image(px_type(i)) );
134
                 end loop;
135
 
136
                 write(l, String'(" buy_sell:"));
137
                 for i in buy_sell'range loop
138
                    write(l, std_logic'image(buy_sell(i)) );
139
                 end loop;
140
 
141
                 write(l, String'(" px:"));
142
                 for i in px'range loop
143
                    write(l, std_logic'image(px(i)) );
144
                 end loop;
145
 
146
                 write(l, String'(" qty:"));
147
                 for i in qty'range loop
148
                    write(l, std_logic'image(qty(i)) );
149
                 end loop;
150
 
151
                 write(l, String'(" sec:"));
152
                 for i in sec'range loop
153
                    write(l, std_logic'image(sec(i)) );
154
                 end loop;
155
 
156
                 write(l, String'(" id:"));
157
                 for i in id'range loop
158
                    write(l, std_logic'image(id(i)) );
159
                 end loop;
160
 
161
                 writeline(output, l);
162
 
163
                 byte_ready <= '0';
164
                 wait for 1 ns;
165
              end loop;
166
 
167
 
168
           write (l, String'("Done parse_price"));
169
           writeline (output, l);
170
 
171
           if (px_type = B"01000") and (buy_sell = B"000") and (px = B"00000000_00001000")
172
              and (qty = B"00110100_00110100")
173
              and (sec = B"01001000_01000001_01000001_01010100_01010100_01010011_01010011")
174
              and (id  = B"01000011_01000011")
175
           then
176
               write (l, String'("... and Price is OK."));
177
               writeline (output, l);
178
           end if;
179
 
180
           wait;
181
        end process;
182
     end behaviour;

powered by: WebSVN 2.1.0

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