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

Subversion Repositories sdhc-sc-core

[/] [sdhc-sc-core/] [trunk/] [grpSd/] [unitTbdSd/] [src/] [TbdSd-Rtl-ea.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 68 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        : TbdSd-Rtl-ea.vhdl
30
-- Owner       : Rainer Kastl
31
-- Description : Testbed for SDHC-SC-Core for SbX
32
-- Links       : 
33
-- 
34 68 rkastl
 
35
library ieee;
36
use ieee.std_logic_1164.all;
37
use ieee.numeric_std.all;
38 75 rkastl
use work.Global.all;
39 68 rkastl
use work.Ics307Values.all;
40 79 rkastl
use work.Rs232.all;
41 89 rkastl
use work.Sd.all;
42 68 rkastl
 
43
entity TbdSd is
44 109 rkastl
        generic (
45 121 rkastl
                gClkFrequency : natural := 100E6
46 109 rkastl
        );
47 68 rkastl
        port (
48
        iClk         : std_ulogic;
49
        inResetAsync : std_ulogic;
50
 
51
        -- SD Card
52
        ioCmd  : inout std_logic; -- Cmd line to and from card
53
        oSclk  : out std_ulogic;
54
        ioData : inout std_logic_vector(3 downto 0);
55
 
56
        -- Ics307
57
        oIcs307Sclk   : out std_ulogic;
58
        oIcs307Data   : out std_ulogic;
59 70 rkastl
        oIcs307Strobe : out std_ulogic;
60
 
61 79 rkastl
        -- Rs232
62
        oTx : out std_ulogic;
63
 
64 70 rkastl
        -- LEDs
65 75 rkastl
        oLedBank : out aLedBank;
66 109 rkastl
        oDigitAdr : out std_ulogic_vector(1 to 3)); -- A,B,C
67 68 rkastl
 
68
end entity TbdSd;
69
 
70
architecture Rtl of TbdSd is
71 79 rkastl
 
72 121 rkastl
        signal RstSync : std_ulogic_vector(1 downto 0);
73 79 rkastl
 
74 122 rkastl
        signal iCyc  : std_ulogic := '0';
75
        signal iLock : std_ulogic := '0';
76
        signal iStb  : std_ulogic := '0';
77
        signal iWe   : std_ulogic := '0';
78
        signal iCti  : std_ulogic_vector(2 downto 0) := (others => '0');
79
        signal iBte  : std_ulogic_vector(1 downto 0) := (others => '0');
80
        signal iSel  : std_ulogic_vector(0 downto 0) := (others => '0');
81
        signal iAdr  : std_ulogic_vector(6 downto 4) := (others => '0');
82
        signal iDat  : std_ulogic_vector(31 downto 0) := (others => '0');
83 79 rkastl
 
84 121 rkastl
        signal oDat  : std_ulogic_vector(31 downto 0);
85
        signal oAck  : std_ulogic;
86
        signal oErr  : std_ulogic;
87
        signal oRty  : std_ulogic;
88 108 rkastl
 
89 150 rkastl
        signal LedBank : std_ulogic_vector(7 downto 0);
90 167 rkastl
        signal LedBank2 : std_ulogic_vector(7 downto 0);
91 136 rkastl
 
92 68 rkastl
begin
93 70 rkastl
 
94 167 rkastl
        oLedBank <= LedBank;
95 150 rkastl
 
96 121 rkastl
        Reg : process (iClk) is
97
        begin
98
                if (rising_edge(iClk)) then
99
                        RstSync(0) <= inResetAsync;
100 122 rkastl
                        RstSync(1) <= not RstSync(0);
101 121 rkastl
                end if;
102
        end process Reg;
103 88 rkastl
 
104 121 rkastl
        oDigitAdr <= "101"; -- DIGIT_6
105
        oTx       <= '1';
106 89 rkastl
 
107 121 rkastl
        Gen100MHz: if gClkFrequency = 100E6 generate
108 111 rkastl
        -- Configure clock to 100MHz
109
                Ics307Configurator_inst : entity work.Ics307Configurator(Rtl)
110
                generic map(
111
                        gCrystalLoadCapacitance_C   => cCrystalLoadCapacitance_C_100MHz,
112
                        gReferenceDivider_RDW       => cReferenceDivider_RDW_100MHz,
113
                        gVcoDividerWord_VDW         => cVcoDividerWord_VDW_100MHz,
114
                        gOutputDivide_S             => cOutputDivide_S_100MHz,
115
                        gClkFunctionSelect_R        => cClkFunctionSelect_R_100MHz,
116
                        gOutputDutyCycleVoltage_TTL => cOutputDutyCycleVoltage_TTL_100MHz
117
                )
118
                port map(
119
                        iClk         => iClk,
120
                        inResetAsync => inResetAsync,
121
                        oSclk        => oIcs307Sclk,
122
                        oData        => oIcs307Data,
123
                        oStrobe      => oIcs307Strobe
124
                );
125
        end generate;
126
 
127 68 rkastl
        SDTop_inst : entity work.SdTop(Rtl)
128 105 rkastl
        generic map (
129 121 rkastl
                gClkFrequency => gClkFrequency,
130 113 rkastl
                gHighSpeedMode => true
131 105 rkastl
        )
132 68 rkastl
        port map (
133 121 rkastl
                iWbClk       => iClk,
134 166 rkastl
                iWbRstSync   => RstSync(1),
135 121 rkastl
 
136
                iCyc         => iCyc,
137
                iLock        => iLock,
138
                iStb         => iStb,
139
                iWe          => iWe,
140
                iCti         => iCti,
141
                iBte         => iBte,
142
                iSel         => iSel,
143
                iAdr         => iAdr,
144
                iDat         => iDat,
145
 
146
                oDat         => oDat,
147
                oAck         => oAck,
148
                oErr         => oErr,
149
                oRty         => oRty,
150
 
151
                iSdClk       => iClk,
152 166 rkastl
                iSdRstSync   => RstSync(1),
153 121 rkastl
                ioCmd        => ioCmd,
154
                oSclk        => oSclk,
155
                ioData       => ioData,
156 150 rkastl
                oLedBank     => LedBank
157 68 rkastl
        );
158
 
159 136 rkastl
        TestWbMaster_inst : entity work.TestWbMaster
160
        port map (
161
                CLK_I => iClk,
162
                RST_I => RstSync(1),
163
                ERR_I => oErr,
164
                RTY_I => oRty,
165
                ACK_I => oAck,
166
                DAT_I => oDat,
167
                CYC_O => iCyc,
168
                STB_O => iStb,
169
                WE_O => iWe,
170
                CTI_O => iCti,
171
                BTE_O => iBte,
172
                ADR_O => iAdr,
173
                DAT_O => iDat,
174
                SEL_O => iSel,
175 167 rkastl
                LEDBANK_O => LedBank2
176 136 rkastl
        );
177
 
178 68 rkastl
end architecture Rtl;
179
 

powered by: WebSVN 2.1.0

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