URL
https://opencores.org/ocsvn/sdhc-sc-core/sdhc-sc-core/trunk
Subversion Repositories sdhc-sc-core
Compare Revisions
- This comparison shows the changes necessary to convert path
/sdhc-sc-core/trunk/src/grpSd/unitTbdSd/src
- from Rev 87 to Rev 88
- ↔ Reverse comparison
Rev 87 → Rev 88
/TbdSd-Rtl-ea.vhdl
48,25 → 48,84
signal iRs232Tx : aiRs232Tx; |
signal oRs232Tx : aoRs232Tx; |
|
signal SdCardStatus : std_ulogic_vector(31 downto 0); |
|
type aState is (send, waitforchange); |
type aReg is record |
State : aState; |
SdCardStatus : std_ulogic_vector(31 downto 0); |
Counter : unsigned(1 downto 0); |
end record aReg; |
|
signal R, NextR : aReg; |
signal Ledbank : aLedBank; |
|
begin |
|
oDigitAdr <= "101"; -- DIGIT_6 |
oTx <= oRs232Tx.Tx; |
iRs232Tx.Transmit <= cActivated; |
iRs232Tx.Data <= X"A1"; |
iRs232Tx.DataAvailable <= cActivated; |
|
oLedBank(6 downto 0) <= Ledbank(6 downto 0); |
oDigitAdr <= "101"; -- DIGIT_6 |
oTx <= oRs232Tx.Tx; |
|
-- Send SdCardStatus via Rs232 |
Rs232_Send : process (iClk, inResetAsync) |
begin |
if (inResetAsync = cnActivated) then |
R.State <= send; |
R.SdCardStatus <= (others => '0'); |
R.Counter <= "11"; |
|
elsif (iClk'event and iClk = cActivated) then |
R <= NextR; |
|
end if; |
end process Rs232_Send; |
|
Rs232_comb : process (oRs232Tx.DataWasRead, SdCardStatus, R) |
begin |
NextR <= R; |
iRs232Tx.Transmit <= cInactivated; |
iRs232Tx.Data <= R.SdCardStatus((to_integer(R.Counter) * 8) + 7 downto to_integer(R.Counter) * 8); |
iRs232Tx.DataAvailable <= cInactivated; |
|
case R.State is |
when waitforchange => |
oLedBank(7) <= cActivated; |
if (R.SdCardStatus /= SdCardStatus) then |
NextR.SdCardStatus <= SdCardStatus; |
NextR.State <= send; |
end if; |
|
when send => |
oLedBank(7) <= cInactivated; |
iRs232Tx.DataAvailable <= cActivated; |
iRs232Tx.Transmit <= cActivated; |
|
if (oRs232Tx.DataWasRead = cActivated) then |
if (R.Counter = "00") then |
NextR.Counter <= "11"; |
NextR.State <= waitforchange; |
else |
NextR.Counter <= R.Counter - 1; |
end if; |
end if; |
|
when others => |
report "Unhandled state" severity error; |
end case; |
|
end process Rs232_comb; |
|
SDTop_inst : entity work.SdTop(Rtl) |
port map ( |
iClk => iClk, |
inResetAsync => inResetAsync, |
ioCmd => ioCmd, |
oSclk => oSclk, |
ioData => ioData, |
oLedBank => oLedBank |
iClk => iClk, |
inResetAsync => inResetAsync, |
ioCmd => ioCmd, |
oSclk => oSclk, |
ioData => ioData, |
oSdCardStatus => SdCardStatus, |
oLedBank => LedBank |
); |
|
|
Rs232Tx_inst : entity work.Rs232Tx |
port map( |
iClk => iClk, |