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

Subversion Repositories spacewire_light

[/] [spacewire_light/] [trunk/] [rtl/] [vhdl/] [spwambapkg.vhd] - Blame information for rev 12

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

Line No. Rev Author Line
1 5 jorisvr
--
2
--  VHDL package for SpaceWire AMBA interface.
3
--
4
--  This package depends on Gaisler GRLIB.
5
--
6
 
7
library ieee;
8
use ieee.std_logic_1164.all;
9
library grlib;
10
use grlib.amba.all;
11
library techmap;
12
use techmap.gencomp.all;
13
use work.spwpkg.all;
14
 
15
package spwambapkg is
16
 
17
 
18
    -- AMBA plug&play device id
19
    constant DEVICE_SPACEWIRELIGHT: amba_device_type := 16#131#;
20
 
21
 
22
    -- Signals from SpaceWire core to AHB master.
23
    type spw_ahbmst_in_type is record
24
 
25
        -- Pulse high to start the RX DMA engine.
26
        rxdma_start:    std_ulogic;
27
 
28
        -- Pulse high to start the TX DMA engine.
29
        txdma_start:    std_ulogic;
30
 
31
        -- Stop TX DMA engine (at end of current burst).
32
        txdma_cancel:   std_ulogic;
33
 
34
        -- Address of current RX descriptor (8-byte aligned).
35
        rxdesc_ptr:     std_logic_vector(31 downto 3);
36
 
37
        -- Address of current TX descriptor (8-byte aligned).
38
        txdesc_ptr:     std_logic_vector(31 downto 3);
39
 
40
        -- Read port of RX FIFO.
41
        rxfifo_rdata:   std_logic_vector(35 downto 0);
42
 
43
        -- High if RX FIFO is empty.
44
        rxfifo_empty:   std_ulogic;
45
 
46
        -- High if RX FIFO will be empty after one read.
47
        -- May combinatorially depend on spw_ahbmst_out_type.rxfifo_read.
48
        rxfifo_nxempty: std_ulogic;
49
 
50
        -- High if TX FIFO is full or has room for at most one word.
51
        txfifo_nxfull:  std_ulogic;
52
 
53
        -- High if TX FIFO is close to full (blocks refill).
54
        txfifo_highw:   std_ulogic;
55
    end record;
56
 
57
    -- Signals from AHB master to SpaceWire core.
58
    type spw_ahbmst_out_type is record
59
 
60
        -- High if the RX DMA engine is enabled.
61
        rxdma_act:      std_ulogic;
62
 
63
        -- High if the TX DMA engine is enabled.
64
        txdma_act:      std_ulogic;
65
 
66
        -- High if an error occurred on the AHB bus.
67
        ahberror:       std_ulogic;
68
 
69
        -- Pulsed high to trigger an RX descriptor interrupt.
70
        int_rxdesc:     std_ulogic;
71
 
72
        -- Pulsed high to trigger a TX descriptor interrupt.
73
        int_txdesc:     std_ulogic;
74
 
75
        -- Pulsed high when a complete packet has been received.
76
        int_rxpacket:   std_ulogic;
77
 
78
        -- Pulsed high to request the next RX descriptor address.
79
        -- (rxdesc_ptr must be updated in the next clock cycle).
80
        rxdesc_next:    std_ulogic;
81
 
82
        -- Pulsed high together with rxdesc_next to wrap the RX descriptor pointer.
83
        rxdesc_wrap:    std_ulogic;
84
 
85
        -- Pulsed high to request the next TX descriptor address.
86
        -- (txdesc_ptr must be updated in the next clock cycle).
87
        txdesc_next:    std_ulogic;
88
 
89
        -- Pulsed high together with txdesc_next to wrap the TX descriptor pointer.
90
        txdesc_wrap:    std_ulogic;
91
 
92
        -- Read strobe to RX fifo.
93
        rxfifo_read:    std_ulogic;
94
 
95
        -- Write enable to TX fifo.
96
        txfifo_write:   std_ulogic;
97
 
98
        -- Input port of TX fifo.
99
        txfifo_wdata:   std_logic_vector(35 downto 0);
100
    end record;
101
 
102
 
103
    -- SpaceWire core with AMBA interface.
104
    component spwamba is
105
        generic (
106
            tech:           integer range 0 to NTECH := DEFFABTECH;
107
            hindex:         integer;                -- AHB master index
108
            pindex:         integer;                -- APB slave index
109
            paddr:          integer;                -- APB address range
110
            pmask:          integer := 16#fff#;     -- APB address mask
111
            pirq:           integer;                -- interrupt number
112
            sysfreq:        real;                   -- system clock frequency in Hz
113
            txclkfreq:      real := 0.0;            -- txclk frequency in Hz
114
            rximpl:         spw_implementation_type := impl_generic;
115
            rxchunk:        integer range 1 to 4 := 1;
116
            tximpl:         spw_implementation_type := impl_generic;
117
            timecodegen:    boolean := true;        -- support timecode generation
118
            rxfifosize:     integer range 6 to 12 := 8; -- size of receive FIFO (2-log of words)
119
            txfifosize:     integer range 2 to 12 := 8; -- size of transmit FIFO (2-log of words)
120
            desctablesize:  integer range 4 to 14 := 10; -- size of the DMA descriptor tables (2-log of descriptors)
121
            maxburst:       integer range 1 to 8 := 3   -- max burst length (2-log of words)
122
        );
123
        port (
124
            clk:        in  std_logic;              -- system clock.
125
            rxclk:      in  std_logic;              -- receiver sample clock
126
            txclk:      in  std_logic;              -- transmit clock
127
            rstn:       in  std_logic;              -- synchronous reset (active-low)
128
            apbi:       in  apb_slv_in_type;        -- APB slave input signals
129
            apbo:       out apb_slv_out_type;       -- APB slave output signals
130
            ahbi:       in  ahb_mst_in_type;        -- AHB master input signals
131
            ahbo:       out ahb_mst_out_type;       -- AHB master output signals
132
            tick_in:    in  std_logic;              -- pulse for timecode generation
133 7 jorisvr
            tick_out:   out std_logic;              -- timecode received
134 5 jorisvr
            spw_di:     in  std_logic;              -- Data In signal from SpaceWire bus
135
            spw_si:     in  std_logic;              -- Strobe In signal from SpaceWire bus
136
            spw_do:     out std_logic;              -- Data Out signal to SpaceWire bus
137
            spw_so:     out std_logic               -- Strobe Out signal to SpaceWire bus
138
        );
139
    end component spwamba;
140
 
141
 
142
    -- AHB master for AMBA interface.
143
    component spwahbmst is
144
        generic (
145
            hindex:         integer;                -- AHB master index
146
            hconfig:        ahb_config_type;        -- AHB plug&play information
147
            maxburst:       integer range 1 to 8    -- 2log of max burst length
148
        );
149
        port (
150
            clk:        in  std_logic;              -- system clock
151
            rstn:       in  std_logic;              -- synchronous reset (active-low)
152
            msti:       in  spw_ahbmst_in_type;     -- inputs from SpaceWire core
153
            msto:       out spw_ahbmst_out_type;    -- outputs to SpaceWire core
154
            ahbi:       in  ahb_mst_in_type;        -- AHB master input signals
155
            ahbo:       out ahb_mst_out_type        -- AHB master output signals
156
        );
157
    end component spwahbmst;
158
 
159
end package;

powered by: WebSVN 2.1.0

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