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

Subversion Repositories sdhc-sc-core

[/] [sdhc-sc-core/] [trunk/] [grpComponents/] [unitIcs307Configurator/] [src/] [Ics307Configurator-Rtl-a.vhdl] - Blame information for rev 185

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 79 rkastl
-------------------------------------------------------------------------------
2
-- Title: 
3
-- Project: FH-Hagenberg/HSSE: Sandbox X general use IP
4
-- Author: Copyright 2006 by Markus Pfaff, Linz/Austria/Europe
5
-------------------------------------------------------------------------------
6
-- $LastChangedDate: 2007-01-09 08:40:02 +0100 (Di, 09 Jän 2007) $
7
-- $LastChangedRevision: 415 $
8
-- $LastChangedBy: pfaff $
9
-- $HeadURL: file:///C:/pfaff/rpySvn/rpySvnSet5/trunk/Uebung/W06Jg04/Uebung03/unitIcs307Configurator/src/Ics307Configurator-Rtl-a.vhd $
10
-- LoginNames: pfaff - Markus Pfaff, Linz/Austria/Europe
11
-------------------------------------------------------------------------------
12
-- Description: 
13
-------------------------------------------------------------------------------
14
 
15
architecture Rtl of Ics307Configurator is
16
 
17
  -----------------------------------------------------------------------------
18
  -- register definition
19
  -----------------------------------------------------------------------------
20
  type    aActivity is (Transmitting, LatchingIn, Completed);
21
  type    aRegion is (RegionC, RegionTTL, RegionF, RegionS, RegionV, RegionR);
22
  subtype aBitIdx is integer range 0 to 8;
23
  subtype aCycleCtr is integer range 0 to 7;
24
 
25
  type aRegSet is record
26
    Activity : aActivity;
27
    Region   : aRegion;
28
    BitIdx   : aBitIdx;
29
    CycleCtr : aCycleCtr;
30
    Sclk     : std_ulogic;
31
    Data     : std_ulogic;
32
  end record aRegSet;
33
 
34
  signal R, NxR : aRegSet;
35
 
36
  constant cRinitVal : aRegSet := (
37
    Activity => Transmitting,
38
    Region   => RegionC,
39
    BitIdx   => aBitIdx'low,
40
    CycleCtr => aCycleCtr'low,
41
    Sclk     => '0',
42
    Data     => '0'
43
    );
44
 
45
begin
46
 
47
  ------------
48
  -- Registers
49
  ------------
50
  Registers : process(iClk, inResetAsync)
51
  begin
52
    if (inResetAsync = cnActivated) then
53
      R <= cRinitVal;
54
    elsif ((iClk'event) and (iClk = '1')) then
55
      R <= NxR;
56
    end if;
57
  end process;
58
 
59
  -----------------------------------------------------------------------------
60
  -- Nx State and Output Logic: Combinatorial
61
  -----------------------------------------------------------------------------
62
  NxStateAndOutput : process (
63
    R
64
    )
65
 
66
  begin
67
 
68
    ---------------------------------------------------------------------------
69
    -- Set Nx State Defaults
70
    ---------------------------------------------------------------------------
71
    NxR <= R;
72
 
73
    ---------------------------------------------------------------------------
74
    -- Set Output Defaults
75
    ---------------------------------------------------------------------------
76
    oStrobe <= cInactivated;
77
 
78
    ---------------------------------------------------------------------------
79
    -- Consider Actual States and Inputs
80
    ---------------------------------------------------------------------------
81
    case R.Activity is
82
 
83
      when Transmitting =>
84
        -- Generating Sclk
85
        if R.CycleCtr /= aCycleCtr'high then
86
          NxR.CycleCtr <= R.CycleCtr + 1;
87
        else
88
          NxR.CycleCtr <= 0;
89
          if R.Sclk = '0' then
90
            -- rising edge of Sclk
91
            NxR.Sclk <= '1';
92
          else
93
            -- falling edge of Sclk
94
            NxR.Sclk <= '0';
95
            -- Adjust Region and BitIdx
96
            if R.BitIdx = 0 then
97
              -- The order of regions is given in the data sheet on page 5.
98
              case R.Region is
99
                when RegionC =>
100
                  NxR.Region <= RegionTTL;
101
                when RegionTTL =>
102
                  NxR.BitIdx <= gClkFunctionSelect_R'left;
103
                  NxR.Region <= RegionF;
104
                when RegionF =>
105
                  NxR.BitIdx <= gOutputDivide_S'left;
106
                  NxR.Region <= RegionS;
107
                when RegionS =>
108
                  NxR.BitIdx <= gVcoDividerWord_VDW'left;
109
                  NxR.Region <= RegionV;
110
                when RegionV =>
111
                  NxR.BitIdx <= gReferenceDivider_RDW'left;
112
                  NxR.Region <= RegionR;
113
                when RegionR =>
114
                  NxR.Activity <= LatchingIn;
115
              end case;
116
            else
117
              NxR.BitIdx <= R.BitIdx - 1;
118
            end if;
119
          end if;
120
        end if;
121
 
122
      when LatchingIn =>
123
        oStrobe <= cActivated;
124
        if R.CycleCtr /= aCycleCtr'high then
125
          NxR.CycleCtr <= R.CycleCtr +1;
126
        else
127
          NxR.Activity <= Completed;
128
        end if;
129
 
130
      when Completed =>
131
        null;
132
 
133
    end case;
134
 
135
    -- Determine data output
136
    case R.Region is
137
      -- The order of regions is given in the data sheet on page 5.
138
      when RegionC =>
139
        oData <= gCrystalLoadCapacitance_C (R.BitIdx);
140
      when RegionTTL =>
141
        oData <= gOutputDutyCycleVoltage_TTL;
142
      when RegionF =>
143
        oData <= gClkFunctionSelect_R(R.BitIdx);
144
      when RegionS =>
145
        oData <= gOutputDivide_S (R.BitIdx);
146
      when RegionV =>
147
        oData <= gVcoDividerWord_VDW (R.BitIdx);
148
      when RegionR =>
149
        oData <= gReferenceDivider_RDW (R.BitIdx);
150
    end case;
151
 
152
  end process NxStateAndOutput;
153
 
154
  oSclk <= R.Sclk;
155
 
156
end Rtl;

powered by: WebSVN 2.1.0

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