OpenCores
URL https://opencores.org/ocsvn/sdhc-sc-core/sdhc-sc-core/trunk

Subversion Repositories sdhc-sc-core

[/] [sdhc-sc-core/] [trunk/] [grpSd/] [pkgSdWb/] [src/] [SdWb-p.vhdl] - Blame information for rev 185

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 164 rkastl
-- SDHC-SC-Core
2
-- Secure Digital High Capacity Self Configuring Core
3 116 rkastl
-- 
4 170 rkastl
-- (C) Copyright 2010, Rainer Kastl
5
-- All rights reserved.
6 164 rkastl
-- 
7 170 rkastl
-- Redistribution and use in source and binary forms, with or without
8
-- modification, are permitted provided that the following conditions are met:
9
--     * Redistributions of source code must retain the above copyright
10
--       notice, this list of conditions and the following disclaimer.
11
--     * Redistributions in binary form must reproduce the above copyright
12
--       notice, this list of conditions and the following disclaimer in the
13
--       documentation and/or other materials provided with the distribution.
14
--     * Neither the name of the <organization> nor the
15
--       names of its contributors may be used to endorse or promote products
16
--       derived from this software without specific prior written permission.
17 164 rkastl
-- 
18 170 rkastl
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  "AS IS" AND
19
-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
-- DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
22
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 164 rkastl
-- 
29
-- File        : SdWb-p.vhdl
30
-- Owner       : Rainer Kastl
31
-- Description : SD Wishbone interface package
32
-- Links       : 
33
-- 
34 116 rkastl
 
35
library ieee;
36
use ieee.std_logic_1164.all;
37
use ieee.numeric_std.all;
38
 
39
package SdWb is
40
 
41
        -- data and address types
42
        subtype aData is std_ulogic_vector(31 downto 0);
43 119 rkastl
        subtype aSdBlockAddr is std_ulogic_vector(31 downto 0);
44 116 rkastl
 
45
        subtype aWbAddr is std_ulogic_vector(6 downto 4);
46
 
47
        -- operation type
48
        subtype aOperation is std_ulogic_vector(31 downto 0);
49
 
50
        -- different valid operation values
51 123 rkastl
        constant cOperationRead  : aOperation := X"00000001";
52
        constant cOperationWrite : aOperation := X"00000010";
53 116 rkastl
 
54
 
55
        -- addresses for register banks in SdWbSlave
56 119 rkastl
 
57 116 rkastl
        constant cOperationAddr : aWbAddr := "000";
58
        constant cStartAddrAddr : aWbAddr := "001";
59
        constant cEndAddrAddr   : aWbAddr := "010";
60
        constant cReadDataAddr  : aWbAddr := "011";
61
        constant cWriteDataAddr : aWbAddr := "100";
62
 
63 119 rkastl
        -- configuration of the next operation
64
        type aOperationBlock is record
65
 
66
                StartAddr       : aSdBlockAddr; -- start block address for SD card the next operation
67
                EndAddr         : aSdBlockAddr; -- last block address
68
                Operation       : aOperation; -- operation to execute (Read, write, etc.)
69
 
70
        end record aOperationBlock;
71
 
72
        constant cDefaultOperationBlock : aOperationBlock := (
73
        StartAddr => (others => '0'),
74
        EndAddr   => (others => '0'),
75
        Operation => (others => '0'));
76
 
77
 
78 116 rkastl
        -- ports
79
        type aSdWbSlaveToSdController is record
80 119 rkastl
 
81 122 rkastl
                AckOperation   : std_ulogic; -- every edge signals that the OperationBlock is valid
82
                OperationBlock : aOperationBlock;
83
                WriteData      : aData; -- data to write to the card (32 bit blocks)
84 119 rkastl
 
85 116 rkastl
        end record aSdWbSlaveToSdController;
86
 
87
        type aSdControllerToSdWbSlave is record
88 119 rkastl
 
89 122 rkastl
                ReqOperation : std_ulogic; -- Request a new OperationBlock
90
                ReadData     : aData;
91 119 rkastl
 
92 116 rkastl
        end record aSdControllerToSdWbSlave;
93
 
94
        type aSdWbSlaveDataOutput is record
95 119 rkastl
 
96 116 rkastl
                Dat : aData;
97 119 rkastl
 
98 116 rkastl
        end record aSdWbSlaveDataOutput;
99
 
100
        type aSdWbSlaveDataInput is record
101 119 rkastl
 
102 116 rkastl
                Sel : std_ulogic_vector(0 downto 0);
103
                Adr : aWbAddr;
104
                Dat : aData;
105 119 rkastl
 
106 116 rkastl
        end record aSdWbSlaveDataInput;
107
 
108
        -- default port values
109
        constant cDefaultSdWbSlaveToSdController : aSdWbSlaveToSdController := (
110 122 rkastl
        OperationBlock => cDefaultOperationBlock,
111
        WriteData      => (others                 => '0'),
112
        AckOperation   => '0');
113 116 rkastl
 
114 122 rkastl
        constant cDefaultSdControllerToSdWbSlave : aSdControllerToSdWbSlave := (
115
        ReqOperation => '0',
116
        ReadData     => (others => '0'));
117
 
118 123 rkastl
        -- to fifo
119
 
120
        type aoWriteFifo is record
121
 
122
                data : aData;
123
                wrreq : std_ulogic; -- write request
124
 
125
        end record aoWriteFifo;
126
 
127
        constant cDefaultoWriteFifo : aoWriteFifo := (
128
        data  => (others => '0'),
129
        wrreq => '0');
130
 
131
        type aiWriteFifo is record
132
 
133
                wrfull : std_ulogic; -- write full
134
 
135
        end record aiWriteFifo;
136 126 rkastl
 
137
        type aoReadFifo is record
138
                rdreq : std_ulogic; -- read request
139
        end record aoReadFifo;
140 123 rkastl
 
141 126 rkastl
        constant cDefaultoReadFifo : aoReadFifo := (rdreq => '0');
142
 
143
        type aiReadFifo is record
144
                q       : std_ulogic_vector(31 downto 0); -- read data (1 cycle after rdreq)
145
                rdempty : std_ulogic; -- no data available
146
        end record aiReadFifo;
147
 
148 116 rkastl
end package SdWb;
149
 

powered by: WebSVN 2.1.0

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