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

Subversion Repositories sdhc-sc-core

[/] [sdhc-sc-core/] [trunk/] [grpSd/] [unitSdWbSdControllerSync/] [src/] [SdWbSdControllerSync-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 122 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        : SdWbSdControllerSync-Rtl-ea.vhdl
30
-- Owner       : Rainer Kastl
31
-- Description : Synchronization of ctrl and data between Wb clock domain and Sd clock domain
32
-- Links       : 
33
-- 
34 122 rkastl
 
35
library ieee;
36
use ieee.std_logic_1164.all;
37
use ieee.numeric_std.all;
38
 
39
use work.global.all;
40
use work.SdWb.all;
41
 
42
entity SdWbControllerSync is
43
        generic (
44
 
45
                -- both clocks are the same, therefore we donĀ“t need synchronization
46
                gUseSameClocks : boolean := false;
47
                gSyncCount     : natural := 2
48
 
49
        );
50
        port (
51
                -- clocked by iWbClk
52
                iWbClk               : in std_ulogic;
53 165 rkastl
                iWbRstSync           : in std_ulogic;
54 122 rkastl
                iSdWb                : in aSdWbSlaveToSdController;
55
                oSdWb                : out aSdControllerToSdWbSlave;
56
 
57
                -- clocked by iSdClk
58
                iSdClk               : in std_ulogic;
59 165 rkastl
                iSdRstSync           : in std_ulogic;
60 122 rkastl
                iSdController        : in aSdControllerToSdWbSlave;
61
                oSdController        : out aSdWbSlaveToSdController
62
 
63
        );
64
end entity SdWbControllerSync;
65
 
66
architecture Rtl of SdWbControllerSync is
67
 
68
        signal ReqOperationSync : std_ulogic;
69
        signal ReqOperationEdge : std_ulogic;
70
 
71
        signal AckOperationSync : std_ulogic;
72
        signal AckOperationEdge : std_ulogic;
73
 
74
begin
75
 
76
        -- synchronization, when different clocks are used
77
        Sync_gen : if gUseSameClocks = false generate
78
 
79
                Sync_ToSdWb: entity work.Synchronizer
80
                generic map (
81
                        gSyncCount => gSyncCount
82
                )
83
                port map (
84 165 rkastl
                        iRstSync => iWbRstSync,
85 122 rkastl
                        iToClk   => iWbClk,
86
                        iSignal  => iSdController.ReqOperation,
87
                        oSync    => ReqOperationSync
88
                );
89
 
90
                Sync_ToSdController: entity work.Synchronizer
91
                generic map (
92
                        gSyncCount => gSyncCount
93
                )
94
                port map (
95 165 rkastl
                        iRstSync => iSdRstSync,
96 122 rkastl
                        iToClk   => iSdClk,
97
                        iSignal  => iSdWb.AckOperation,
98
                        oSync    => AckOperationSync
99
                );
100
 
101
        end generate;
102
 
103
        -- no synchronization, when the same clocks are used
104
        NoSync_gen : if gUseSameClocks = true generate
105
 
106
                ReqOperationSync <= iSdController.ReqOperation;
107
                AckOperationSync <= iSdWb.AckOperation;
108
 
109
        end generate;
110
 
111
        -- detect egdes: every toggle is a new request / acknowledgement
112
        ReqEdge_inst : entity work.EdgeDetector
113
        generic map (
114
                gEdgeDetection     => cDetectAnyEdge,
115
                gOutputRegistered  => false
116
        )
117
        port map (
118
                iClk               => iWbClk,
119 165 rkastl
                iRstSync           => iWbRstSync,
120 122 rkastl
                iLine              => ReqOperationSync,
121
                iClearEdgeDetected => cInactivated,
122
                oEdgeDetected      => ReqOperationEdge
123
        );
124
 
125
        AckEdge_inst : entity work.EdgeDetector
126
        generic map (
127
                gEdgeDetection     => cDetectAnyEdge,
128
                gOutputRegistered  => false
129
        )
130
        port map (
131
                iClk               => iSdClk,
132 165 rkastl
                iRstSync           => iSdRstSync,
133 122 rkastl
                iLine              => AckOperationSync,
134
                iClearEdgeDetected => cInactivated,
135
                oEdgeDetected      => AckOperationEdge
136
        );
137
 
138
        -- outputs
139
 
140
        oSdWb.ReqOperation <= ReqOperationEdge;
141
        oSdWb.ReadData     <= iSdController.ReadData;
142
 
143
        oSdController.AckOperation   <= AckOperationEdge;
144
        oSdController.OperationBlock <= iSdWb.OperationBlock;
145
        oSdController.WriteData      <= iSdWb.WriteData;
146
 
147
end architecture Rtl;
148
 
149
 

powered by: WebSVN 2.1.0

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