##############################################################################
## This file is part of 'SLAC Firmware Standard Library'.
## It is subject to the license terms in the LICENSE.txt file found in the 
## top-level directory of this distribution and at: 
##    https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. 
## No part of 'SLAC Firmware Standard Library', including this file, 
## may be copied, modified, propagated, or distributed except according to 
## the terms contained in the LICENSE.txt file.
##############################################################################
#schemaversion 3.0.0
#once

SysgenMR: &SysgenMR 
  description: "Sysgen MR Module"
  class: MMIODev
  configPrio: 1
  size: 0x1000 
  #########
  children:
  #########
    #########################################################
    Status:
      class: IntField
      at:
        offset: 0x000
        nelms: 10
      mode: RO
      description: "Status registers"
    #########################################################
    Mux1:
      class: IntField
      at:
        offset: 0x800
      sizeBits: 1
      lsBit: 0
      mode: RW
      description: "LO DAC control 0 for PLL 1 for manual"
    #########################################################
    Mux2:
      class: IntField
      at:
        offset: 0x800
      sizeBits: 1
      lsBit: 1
      mode: RW
      description: "CLK DAC control 0 for PLL 1 for manual"
    #########################################################
    Mux3:
      class: IntField
      at:
        offset: 0x800
      sizeBits: 2
      lsBit: 2
      mode: RW
      description: "Monitor DAC control 0: LO PLL vco 1: LO PLL PD 2: CLK PLL vco 3: CLK PLL PD"
    #########################################################
    IF_FF_ENABLE:
      class: IntField
      at:
        offset: 0x800
      sizeBits: 2
      lsBit: 4
      mode: RW
      description: "IF FF enable 0: Off 1: On positive polarity 2: On negative polarity 3: On negative polarity"
    #########################################################
    LO_REF_ADC_SEL:
      class: IntField
      at:
        offset: 0x801
      sizeBits: 1
      lsBit: 0
      mode: RW
      description: "LO ref ADC select 0: ADC 0_5 1: ADC 1_0"
    #########################################################
    CLK_REF_ADC_SEL:
      class: IntField
      at:
        offset: 0x801
      sizeBits: 1
      lsBit: 1
      mode: RW
      description: "CLK ref ADC select 0: ADC 1_5 1: ADC 1_4"
    #########################################################
    ORDER_MUX:
      class: IntField
      at:
        offset: 0x801
      sizeBits: 1
      lsBit: 2
      mode: RW
      description: "DAC OUT ORDER MUX"
    #########################################################
    ADC_ORDER_MUX:
      class: IntField
      at:
        offset: 0x801
      sizeBits: 1
      lsBit: 3
      mode: RW
      description: "ADC IN ORDER MUX"
    #########################################################
    CLK_RECOVER_MUX:
      class: IntField
      at:
        offset: 0x801
      sizeBits: 1
      lsBit: 4
      mode: RW
      description: "0 use ADPLL 1 use LUT"
    #########################################################
    DDS_RESET:
      class: IntField
      at:
        offset: 0x801
      sizeBits: 1
      lsBit: 5
      mode: RW
      description: "Active low DDS RESET"
    #########################################################
    CH_MUX :
      class: IntField
      at:
        offset: 0x802
      sizeBits: 3
      lsBit: 0
      mode: RW
      description: "MUX for PIPELINED DDC"
    #########################################################
    DDC_CLK_MUX :
      class: IntField
      at:
        offset: 0x802
      sizeBits: 1
      lsBit: 3
      mode: RW
      description: "MUX for CLK PD DDC"
    #########################################################
    DLO_SEL:
      class: IntField
      at:
        offset: 0x802
      sizeBits: 1
      lsBit: 4
      mode: RW
      description: "Digital LO SEL, 0 fixed, 1 ADPLL"
    #########################################################:
    ERR_RESET:
      class: IntField
      at:
        offset: 0x802
      sizeBits: 1
      lsBit: 5
      mode: RW
      description: "Repeat error reset"
    #########################################################
    LovcoDACSet:
      class: IntField
      at:
        offset: 0x804
      sizeBits: 16
      lsBit: 0
      mode: RW
      description: "manual DAC settings for LO VCO (signed)"
    #########################################################
    IFsetI:
      class: IntField
      at:
        offset: 0x808
      sizeBits: 16
      lsBit: 0
      mode: RW
      description: "IFSet I signed"
    #########################################################
    IFsetQ:
      class: IntField
      at:
        offset: 0x80A
      sizeBits: 16
      lsBit: 0
      mode: RW
      description: "IFSet Q signed"
    #########################################################
    LOPhaseSet:
      class: IntField
      at:
        offset: 0x80C
      sizeBits: 16
      lsBit: 0
      mode: RW
      description: "Lo phase set signed"
    #########################################################
    CkvcoDACSet:
      class: IntField
      at:
        offset: 0x810
      sizeBits: 16
      lsBit: 0
      mode: RW
      description: "manual settings for clock VCO (signed)"
    #########################################################
    LO_KP:
      class: IntField
      at:
        offset: 0x814
      sizeBits: 16
      lsBit: 0
      mode: RW
      description: "LO loop P term gain"
    #########################################################
    LO_KI:
      class: IntField
      at:
        offset: 0x816
      sizeBits: 16
      lsBit: 0
      mode: RW
      description: "LO loop I term"
    #########################################################
    CLK_KP:
      class: IntField
      at:
        offset: 0x818
      sizeBits: 16
      lsBit: 0
      mode: RW
      description: "CLK loop P term"
    #########################################################
    CLK_KI:
      class: IntField
      at:
        offset: 0x81A
      sizeBits: 16
      lsBit: 0
      mode: RW
      description: "CLK loop I term"
    #########################################################
    ADPLL_KI:
      class: IntField
      at:
        offset: 0x81C
      sizeBits: 32
      lsBit: 0
      mode: RW
      description: "ADPLL loop I term"
    #########################################################
    ADPLL:
      class: IntField
      at:
        offset: 0x820
      sizeBits: 32
      lsBit: 0
      mode: RW
      description: "ADPLL loop P term"
    #########################################################
    CK_DIVIDE:
      class: IntField
      at:
        offset: 0x828
      sizeBits: 16
      lsBit: 0
      mode: RW
      description: "CLK DIVIDE"
    #########################################################
    BAY0_GAIN:
      class: IntField
      at:
        offset: 0x82C
      sizeBits: 8
      lsBit: 0
      mode: RW
      description: "Bay0 GAIN, u8_4"
    #########################################################
    BAY1_GAIN:
      class: IntField
      at:
        offset: 0x82D
      sizeBits: 8
      lsBit: 0
      mode: RW
      description: "Bay1 GAIN, u8_4"
    #########################################################
    LO_REF_SEL:
      class: IntField
      at:
        offset: 0x82E
      sizeBits: 3
      lsBit: 0
      mode: RW
      description: "LO REF SEL, for PLL + ADPLL"
    #########################################################
