1 -------------------------------------------------------------------------------     2 -- File       : AxiAd5780Ser.vhd     3 -- Company    : SLAC National Accelerator Laboratory     4 -- Created    : 2014-04-18     5 -- Last update: 2014-04-25     6 -------------------------------------------------------------------------------     7 -- Description: AD5780 DAC Module's serializer     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_unsigned.
all;
    21 use ieee.std_logic_arith.
all;
    27  --! @ingroup devices_AnalogDevices_ad5780    36       -- DAC Data Interface (axiClk domain)    43       dacData       : in  slv(17 downto 0);
  -- 2's complement by default    53    constant CS_WAIT_C :  := (getTimeRatio(AXI_CLK_FREQ_G, 20.
0E+6));
  -- 50 ns wait min.    61    type RegType is record    67       cnt        : slv(7 downto 0);
    68       cntSck     : slv(31 downto 0);
    69       csWait     :  range 0 to CS_WAIT_C;
    70       reg        : slv(
23 downto 0);
    73    constant REG_INIT_C : RegType := (    84    signal r   : RegType := REG_INIT_C;
    93       -- Latch the current value    96       -- Reset strobe signals   101          ----------------------------------------------------------------------   104             v.cntSck := r.cntSck + 1;
   105             if r.cntSck = 255 then   107                v.cntSck := (others => '0');
   112                   v.cnt   := (others => '0');
   116                   v.state := RST_WAIT_S;
   119          ----------------------------------------------------------------------   121             -- Preset the serial bit   124             v.cntSck := r.cntSck + 1;
   125             if r.cntSck = 255 then   127                v.cntSck := (others => '0');
   132                   v.cnt               := (others => '0');
   134                   v.reg(23 downto 20) := "0010";
       -- CTRL_REG: write to control register   135                   v.reg(19 downto 6)  := (others => '0');
  -- Reserved: reserved should be set to zero   136                   -- Configuration bits   137                   v.reg(5)            := sdoDisable;
   -- SDODIS: disable SDO   138                   v.reg(4)            := binaryOffset;
     -- BIN/2sC: use 2's complement   139                   v.reg(3)            := dacTriState;
  -- DACTRI: put DAC into normal operating mode   140                   v.reg(2)            := opGnd;
        -- OPGND: put DAC into normal operating mode   141                   v.reg(1)            := rbuf;
         -- RBUF: Unity-Gain Configuration    142                   v.reg(0)            := '0';
  -- Reserved: reserved should be set to zero                143                   -- Set the chip select flag   145                   -- Preset the counter   148                   v.state             := SCK_HIGH_S;
   151          ----------------------------------------------------------------------   155             -- Set the serial bit   158             v.cntSck := r.cntSck + 1;
   161                   -- Preset the counter   165                   v.cntSck := (others => '0');
   168                v.state := SCK_LOW_S;
   170          ----------------------------------------------------------------------   175             v.cntSck := r.cntSck + 1;
   178                v.cntSck           := (others => '0');
   180                v.reg(23 downto 1) := r.reg(22 downto 0);
   186                   v.cnt   := (others => '0');
   191                   v.state := SCK_HIGH_S;
   194          ----------------------------------------------------------------------   198             -- Release the chip select   200             -- Preset the serial bit   203             v.csWait := r.csWait + 1;
   204             if r.csWait = CS_WAIT_C then   207                -- Latch the DAC data   208                v.reg        := "0001" & dacData & "00";
   209                -- Set the chip select flag   211                -- Preset the counter   213                -- Strobe the refresh flag   216                v.state      := SCK_HIGH_S;
   218       ----------------------------------------------------------------------   226       -- Register the variable for next clock cycle   243       if rising_edge(axiClk) then   244          r <= rin after TPD_G;
 
in dacDataslv( 17 downto  0)  
 
in halfSckPeriodslv( 31 downto  0)  
 
AXI_CLK_FREQ_Greal  := 200.0E+6
 
out dacOutAxiAd5780OutType