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

Subversion Repositories open_hitter

[/] [open_hitter/] [trunk/] [rtl/] [vhdl/] [parse_price.vhd] - Blame information for rev 10

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 10 stvhawes
--////////////////////////////////////////////////////////////////////
2
--//                                                              ////
3
--// parse_price.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
--// Byte stream input, open hitter price output                  ////
10
--//                                                              ////
11
--// To Do:                                                       ////
12
--//    #LOTS                                                     ////
13
--//                                                              ////
14
--// Author(s):                                                   ////
15
--// - Stephen Hawes                                              ////
16
--//                                                              ////
17
--////////////////////////////////////////////////////////////////////
18
--//                                                              ////
19
--// Copyright (C) 2015 Stephen Hawes and OPENCORES.ORG           ////
20
--//                                                              ////
21
--// This source file may be used and distributed without         ////
22
--// restriction provided that this copyright statement is not    ////
23
--// removed from the file and that any derivative work contains  ////
24
--// the original copyright notice and the associated disclaimer. ////
25
--//                                                              ////
26
--// This source file is free software; you can redistribute it   ////
27
--// and/or modify it under the terms of the GNU Lesser General   ////
28
--// Public License as published by the Free Software Foundation; ////
29
--// either version 2.1 of the License, or (at your option) any   ////
30
--// later version.                                               ////
31
--//                                                              ////
32
--// This source is distributed in the hope that it will be       ////
33
--// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
34
--// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
35
--// PURPOSE. See the GNU Lesser General Public License for more  ////
36
--// details.                                                     ////
37
--//                                                              ////
38
--// You should have received a copy of the GNU Lesser General    ////
39
--// Public License along with this source; if not, download it   ////
40
--// from <http://www.opencores.org/lgpl.shtml>                   ////
41
--//                                                              ////
42
--////////////////////////////////////////////////////////////////////
43
--//
44
--// \$Id\$  TAKE OUT THE \'s and this comment in order to get this to work
45
--//
46
--// CVS Revision History
47
--//
48
--// \$Log\$  TAKE OUT THE \'s and this comment in order to get this to work
49
--//
50
library ieee;
51
use ieee.std_logic_1164.all;
52
 
53
entity parse_price is
54
   port (
55
        RX_CLK: in std_logic;
56
        in_byte: in std_logic_vector(7 downto 0);
57
        byte_reset: in std_logic;
58
        byte_ready: in std_logic;
59
        price_ready: out std_logic;
60
        -- pxdata: out price_packet
61
           px_type: out std_logic_vector(4 downto 0);
62
           buy_sell: out std_logic_vector(2 downto 0);   -- 111 buy, 000 sell
63
           px: out std_logic_vector(15 downto 0);     -- price
64
           qty: out std_logic_vector(15 downto 0);    -- quantity
65
           sec: out std_logic_vector(55 downto 0);    -- 7x 8bits securities identifier
66
           id: out std_logic_vector(15 downto 0)     -- unique/identifier/counter
67
   );
68
end parse_price;
69
 
70
architecture parse_price_implementation of parse_price is
71
   signal infield: std_logic_vector(55 downto 0);
72
   signal pos: integer range 0 to 14 := 14;
73
begin
74
   parse: process (RX_CLK) is
75
   begin
76
      if rising_edge(RX_CLK) then
77
         case pos is
78
            when 0 =>
79
                px_type <= in_byte(7 downto 3);
80
                buy_sell <= in_byte(2 downto 0);
81
            when 2 =>
82
                px(15 downto 8) <= infield(7 downto 0);
83
                px(7 downto 0) <= in_byte;
84
            when 4 =>
85
                qty(15 downto 8) <= infield(7 downto 0);
86
                qty(7 downto 0) <= in_byte;
87
            when 11 =>
88
                sec(55 downto 8) <= infield(47 downto 0);
89
                sec(7 downto 0) <= in_byte;
90
            when 13 =>
91
                id(15 downto 8) <= infield(7 downto 0);
92
                id(7 downto 0) <= in_byte;
93
                price_ready <= std_logic'('1');
94
            when others => null;
95
         end case;
96
 
97
         if (byte_reset = '1') then
98
            pos <= 0;
99
         elsif (pos = 14) then
100
            pos <= 14;
101
         elsif (byte_ready = '1') then
102
            pos <= pos+1;
103
         else
104
            pos <= pos;
105
         end if;
106
 
107
         infield(55 downto 8) <= infield(47 downto 0);
108
         infield(7 downto 0) <= in_byte;
109
 
110
      end if;
111
   end process parse;
112
 
113
end parse_price_implementation;
114
 
115
-- 2008: can make price packet generic, eg;
116
--    generic ( type price_packet );
117
-- type price_packet is record
118
--    px_type: std_logic_vector(4 downto 0);
119
--    buy_sell: std_logic_vector(2 downto 0);   -- 111 buy, 000 sell
120
--    px: std_logic_vector(15 downto 0);     -- price   
121
--    qty: std_logic_vector(15 downto 0);    -- quantity
122
--    sec: std_logic_vector(55 downto 0);    -- 7x 8bits securities identifier
123
--    id: std_logic_vector(15 downto 0);     -- unique/identifier/counter
124
-- end record price_packet;
125
 

powered by: WebSVN 2.1.0

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