1 ------------------------------------------------------------------------------- 2 -- File : DS2411Core.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2007-12-19 5 -- Last update: 2015-01-14 6 ------------------------------------------------------------------------------- 7 -- Description: Controller for DS2411 64-bit serial ID PROM 8 ------------------------------------------------------------------------------- 9 -- This file is part of 'SLAC Firmware Standard Library'. 10 -- It is subject to the license terms in the LICENSE.txt file found in the 11 -- top-level directory of this distribution and at: 12 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. 13 -- No part of 'SLAC Firmware Standard Library', including this file, 14 -- may be copied, modified, propagated, or distributed except according to 15 -- the terms contained in the LICENSE.txt file. 16 ------------------------------------------------------------------------------- 19 use ieee.std_logic_1164.
all;
20 use ieee.std_logic_arith.
all;
21 use ieee.std_logic_unsigned.
all;
24 use UNISIM.VCOMPONENTS.
all;
29 --! @ingroup base_general 37 -- Clock & Reset Signals 57 nxtState : StateType := ST_START;
65 timeCntRst : sl := '1';
66 signal timeCnt : slv(31 downto 0) := (others => '0');
67 signal bitCnt : slv(5 downto 0) := (others => '0');
68 signal setOutLowInv : sl;
69 signal fdSerial : slv(63 downto 0) := (others => '0');
73 fdValue <= fdSerial when(fdValidSet = '1') else (others => '0');
84 setOutLowInv <= not setOutLow;
85 FD_SER_SDIO_BUFT : IOBUF
92 -- fdSerSdio <= '0' when(setOutLow = '1') else 'Z'; 93 -- fdSerDin <= fdSerSdio; 99 fdSerial <= (others => '0') after TPD_G;
101 timeCnt <= (others => '0') after TPD_G;
102 bitCnt <= (others => '0') after TPD_G;
103 curState <= ST_START after TPD_G;
104 elsif rising_edge(clk) then 106 -- Shift new serial data 107 if fdValidSet = '1' then 111 -- Bit Set Of Received Data 113 fdSerial(conv_integer(bitCnt)) <= fdSerDin after TPD_G;
117 if bitCntRst = '1' then 118 bitCnt <= (others => '0') after TPD_G;
119 elsif bitCntEn = '1' then 120 bitCnt <= bitCnt + 1 after TPD_G;
124 if timeCntRst = '1' then 125 timeCnt <= (others => '0') after TPD_G;
127 timeCnt <= timeCnt + 1 after TPD_G;
131 curState <= nxtState after TPD_G;
138 process (bitCnt, curState, timeCnt)
153 if timeCnt = toSlv(getTimeRatio(830.0E-6
, CLK_PERIOD_G), 32) then 154 nxtState <= ST_RESET;
157 nxtState <= curState;
169 -- Continue for 500us 170 if timeCnt = toSlv(getTimeRatio(500.0E-6
, CLK_PERIOD_G), 32) then 174 nxtState <= curState;
187 if timeCnt = toSlv(getTimeRatio(500.0E-6
, CLK_PERIOD_G), 32) then 188 nxtState <= ST_WRITE;
191 nxtState <= curState;
195 -- Write Command Bits To PROM (0x33) 200 -- Assert start pulse for 12us 201 if timeCnt < toSlv(getTimeRatio(12.0E-6
, CLK_PERIOD_G), 32) then 207 nxtState <= curState;
209 -- Output write value for 52uS 210 elsif timeCnt < toSlv(getTimeRatio(52.0E-6
, CLK_PERIOD_G), 32) then 211 if bitCnt = 2 or bitCnt = 3 or bitCnt = 6 or bitCnt = 7 then 216 nxtState <= curState;
221 -- Recovery Time of 62.4us 222 elsif timeCnt < toSlv(getTimeRatio(62.4E-6
, CLK_PERIOD_G), 32) then 224 nxtState <= curState;
238 nxtState <= ST_PAUSE;
241 nxtState <= curState;
254 if timeCnt = toSlv(getTimeRatio(60.0E-6
, CLK_PERIOD_G), 32) then 258 nxtState <= curState;
262 -- Read Data Bits From Prom 266 -- Assert start pulse for 12us 267 if timeCnt < toSlv(getTimeRatio(12.0E-6
, CLK_PERIOD_G), 32) then 273 nxtState <= curState;
275 -- Sample data at 13.1uS 276 elsif timeCnt = toSlv(getTimeRatio(13.1E-6
, CLK_PERIOD_G), 32) then 282 nxtState <= curState;
284 -- Recovery Time of 62.4us 285 elsif timeCnt < toSlv(getTimeRatio(62.4E-6
, CLK_PERIOD_G), 32) then 291 nxtState <= curState;
306 nxtState <= curState;
318 nxtState <= curState;
327 nxtState <= ST_START;
SIM_OUTPUT_Gslv( 63 downto 0) := x"0123456789ABCDEF"
CLK_PERIOD_Greal := 6.4E-9
SIMULATION_Gboolean := false
out fdValueslv( 63 downto 0)