diff --git a/AmcCarrierCore/core/AmcCarrierPkg.vhd b/AmcCarrierCore/core/AmcCarrierPkg.vhd index 31a51513..9df1e8e7 100644 --- a/AmcCarrierCore/core/AmcCarrierPkg.vhd +++ b/AmcCarrierCore/core/AmcCarrierPkg.vhd @@ -25,8 +25,8 @@ use lcls_timing_core.TimingPkg.all; package AmcCarrierPkg is - -- https://github.com/slaclab/amc-carrier-core/releases/tag/v5.0.0 - constant AMC_CARRIER_CORE_VERSION_C : slv(31 downto 0) := x"05_00_00_00"; + -- https://github.com/slaclab/amc-carrier-core/releases/tag/v5.1.0 + constant AMC_CARRIER_CORE_VERSION_C : slv(31 downto 0) := x"05_01_00_00"; ----------------------------------------------------------- -- Application: Configurations, Constants and Records Types diff --git a/AppMps/rtl/AppMpsEncoder.vhd b/AppMps/rtl/AppMpsEncoder.vhd index 0367544d..9901795c 100644 --- a/AppMps/rtl/AppMpsEncoder.vhd +++ b/AppMps/rtl/AppMpsEncoder.vhd @@ -58,13 +58,17 @@ architecture mapping of AppMpsEncoder is constant APP_CONFIG_C : MpsAppConfigType := getMpsAppConfig(APP_TYPE_G); type RegType is record - tholdMem : Slv4VectorArray(MPS_CHAN_COUNT_C-1 downto 0, 7 downto 0); - mpsMessage : MpsMessageType; + mpsTripValue : Slv32Array(MPS_CHAN_COUNT_C-1 downto 0); + tripPulseId : Slv64Array(MPS_CHAN_COUNT_C-1 downto 0); + tholdMem : Slv4VectorArray(MPS_CHAN_COUNT_C-1 downto 0, 7 downto 0); + mpsMessage : MpsMessageType; end record; constant REG_INIT_C : RegType := ( - tholdMem => (others => (others => (others => '0'))), - mpsMessage => mpsMessageInit(APP_CONFIG_C.BYTE_COUNT_C)); + mpsTripValue => (others => (others => '0')), + tripPulseId => (others => (others => '0')), + tholdMem => (others => (others => (others => '0'))), + mpsMessage => mpsMessageInit(APP_CONFIG_C.BYTE_COUNT_C)); signal r : RegType := REG_INIT_C; signal rin : RegType; @@ -78,6 +82,9 @@ architecture mapping of AppMpsEncoder is valid : in sl; holdDisable : in sl; bitPos : in integer; + pulseIdIn : in slv; + tripPulseId : inout slv; + tripValue : inout slv; tholdMemOut : inout slv; message : inout Slv8Array) is @@ -101,6 +108,9 @@ architecture mapping of AppMpsEncoder is message(config.BYTE_MAP_C)(bitPos) := '1'; + tripValue := value; + tripPulseId := pulseIdIn; + end if; end procedure; @@ -124,8 +134,9 @@ architecture mapping of AppMpsEncoder is end if; end procedure; - signal mpsReg : MpsAppRegType; - signal mpsMsgDrop : sl; + signal mpsReg : MpsAppRegType; + signal mpsMsgDrop : sl; + signal rstTripValue : sl; -- attribute MARK_DEBUG : string; -- attribute MARK_DEBUG of r : signal is "TRUE"; @@ -155,6 +166,9 @@ begin axilWriteSlave => axilWriteSlave, mpsMessage => r.mpsMessage, mpsMsgDrop => mpsMsgDrop, + mpsTripValue => r.mpsTripValue, + tripPulseId => r.tripPulseId, + rstTripValue => rstTripValue, mpsAppRegisters => mpsReg); --------------------------------- @@ -177,7 +191,7 @@ begin --------------------------------- -- Thresholds --------------------------------- - comb : process (axilRst, mpsReg, mpsSelect, r) is + comb : process (axilRst, mpsReg, mpsSelect, r, rstTripValue) is variable v : RegType; variable chan : integer; variable thold : integer; @@ -245,14 +259,14 @@ begin compareTholds (mpsReg.mpsChanReg(chan).lcls1Thold, APP_CONFIG_C.CHAN_CONFIG_C(chan), mpsSelect.chanData(chan), mpsSelect.mpsIgnore(chan), mpsSelect.valid, '1', - 0, v.tholdMem(chan, 0), msgData); + 0, diagnosticBus.timingMessage.pulseId, v.tripPulseId(chan), v.mpsTripValue(chan), v.tholdMem(chan, 0), msgData); -- LCLS2 idle table elsif APP_CONFIG_C.CHAN_CONFIG_C(chan).IDLE_EN_C and mpsReg.mpsChanReg(chan).idleEn = '1' and mpsSelect.selectIdle = '1' then compareTholds (mpsReg.mpsChanReg(chan).idleThold, APP_CONFIG_C.CHAN_CONFIG_C(chan), mpsSelect.chanData(chan), mpsSelect.mpsIgnore(chan), mpsSelect.valid, '0', - 7, v.tholdMem(chan, 7), msgData); + 7, diagnosticBus.timingMessage.pulseId, v.tripPulseId(chan), v.mpsTripValue(chan), v.tholdMem(chan, 7), msgData); -- Multiple thresholds else @@ -263,14 +277,14 @@ begin compareTholds (mpsReg.mpsChanReg(chan).altTholds(thold), APP_CONFIG_C.CHAN_CONFIG_C(chan), mpsSelect.chanData(chan), mpsSelect.mpsIgnore(chan), mpsSelect.valid, '0', - thold, v.tholdMem(chan, thold), msgData); + thold, diagnosticBus.timingMessage.pulseId, v.tripPulseId(chan), v.mpsTripValue(chan), v.tholdMem(chan, thold), msgData); -- Standard table else compareTholds (mpsReg.mpsChanReg(chan).stdTholds(thold), APP_CONFIG_C.CHAN_CONFIG_C(chan), mpsSelect.chanData(chan), mpsSelect.mpsIgnore(chan), mpsSelect.valid, '0', - thold, v.tholdMem(chan, thold), msgData); + thold, diagnosticBus.timingMessage.pulseId, v.tripPulseId(chan), v.mpsTripValue(chan), v.tholdMem(chan, thold), msgData); end if; end loop; end if; @@ -281,6 +295,12 @@ begin -- Update message data v.mpsMessage.message(APP_CONFIG_C.BYTE_COUNT_C-1 downto 0) := msgData; + -- Check for trip value reset + if (rstTripValue = '1') then + v.mpsTripValue := (others => (others => '0')); + v.tripPulseId := (others => (others => '0')); + end if; + -- Synchronous Reset if (axilRst = '1') then v := REG_INIT_C; diff --git a/AppMps/rtl/AppMpsReg.vhd b/AppMps/rtl/AppMpsReg.vhd index f8bb2bdd..875ab564 100644 --- a/AppMps/rtl/AppMpsReg.vhd +++ b/AppMps/rtl/AppMpsReg.vhd @@ -45,6 +45,9 @@ entity AppMpsReg is -- MPS message monitoring mpsMessage : in MpsMessageType; mpsMsgDrop : in sl; + mpsTripValue : in Slv32Array(MPS_CHAN_COUNT_C-1 downto 0); + tripPulseId : in Slv64Array(MPS_CHAN_COUNT_C-1 downto 0); + rstTripValue : out sl; -- MPS Configuration Registers mpsAppRegisters : out MpsAppRegType); end AppMpsReg; @@ -103,6 +106,7 @@ begin -- MPS message monitoring mpsMessage => mpsMessage, mpsMsgDrop => mpsMsgDrop, + rstTripValue => rstTripValue, -- MPS Configuration Registers mpsCore => mpsAppRegisters.mpsCore, beamDestMask => mpsAppRegisters.beamDestMask, @@ -143,6 +147,8 @@ begin port map ( -- MPS Configuration Registers mpsChanReg => mpsAppRegisters.mpsChanReg(i), + mpsTripValue => mpsTripValue(i), + tripPulseId => tripPulseId(i), -- AXI-Lite Interface axilClk => axilClk, axilRst => axilRst, diff --git a/AppMps/rtl/AppMpsRegAppCh.vhd b/AppMps/rtl/AppMpsRegAppCh.vhd index a47b131f..ec18fb07 100644 --- a/AppMps/rtl/AppMpsRegAppCh.vhd +++ b/AppMps/rtl/AppMpsRegAppCh.vhd @@ -38,6 +38,8 @@ entity AppMpsRegAppCh is port ( -- MPS Configuration Registers mpsChanReg : out MpsChanRegType; + mpsTripValue : in slv(31 downto 0); + tripPulseId : in slv(63 downto 0); -- AXI-Lite Interface axilClk : in sl; axilRst : in sl; @@ -65,7 +67,7 @@ architecture mapping of AppMpsRegAppCh is begin - comb : process (axilReadMaster, axilRst, axilWriteMaster, r) is + comb : process (axilReadMaster, axilRst, axilWriteMaster, mpsTripValue, r, tripPulseId) is variable v : RegType; variable regEp : AxiLiteEndPointType; variable thold : natural; @@ -91,6 +93,12 @@ begin axiSlaveRegisterR(regEp, toSlv(0, 9), 10, ite(CHAN_CONFIG_G.LCLS1_EN_C, '1', '0')); axiSlaveRegisterR(regEp, toSlv(0, 9), 16, toSlv(CHAN_CONFIG_G.BYTE_MAP_C, 8)); + -- Offset 0x4 + axiSlaveRegisterR(regEp, toSlv(4, 9), 0, mpsTripValue); + + -- Offset 0x8, 0xC + axiSlaveRegisterR(regEp, toSlv(8, 9), 0, tripPulseId); + -- Offset 0x10, 0x14, 0x18 if CHAN_CONFIG_G.LCLS1_EN_C then axiSlaveRegister(regEp, toSlv(16, 9), 0, v.mpsChanReg.lcls1Thold.minTholdEn); diff --git a/AppMps/rtl/AppMpsRegBase.vhd b/AppMps/rtl/AppMpsRegBase.vhd index aebfa836..f24dc5dc 100644 --- a/AppMps/rtl/AppMpsRegBase.vhd +++ b/AppMps/rtl/AppMpsRegBase.vhd @@ -40,6 +40,7 @@ entity AppMpsRegBase is -- MPS message monitoring mpsMessage : in MpsMessageType; mpsMsgDrop : in sl; + rstTripValue : out sl; -- MPS Configuration Registers mpsCore : out MpsCoreRegType; beamDestMask : out slv(15 downto 0); @@ -57,6 +58,7 @@ end AppMpsRegBase; architecture mapping of AppMpsRegBase is type RegType is record + rstTripValue : sl; mpsCore : MpsCoreRegType; beamDestMask : slv(15 downto 0); altDestMask : slv(15 downto 0); @@ -68,6 +70,7 @@ architecture mapping of AppMpsRegBase is end record; constant REG_INIT_C : RegType := ( + rstTripValue => '0', mpsCore => MPS_CORE_REG_INIT_C, beamDestMask => (others => '0'), altDestMask => (others => '0'), @@ -105,33 +108,35 @@ begin axiSlaveWaitTxn(regEp, axilWriteMaster, axilReadMaster, v.axilWriteSlave, v.axilReadSlave); -- Top level registers - axiSlaveRegister(regEp, x"0000", 0, v.mpsCore.mpsAppId); - axiSlaveRegister(regEp, x"0000", 16, v.mpsCore.mpsEnable); - axiSlaveRegister(regEp, x"0000", 17, v.mpsCore.lcls1Mode); - axiSlaveRegister(regEp, x"0000", 24, v.mpsCore.mpsVersion); + axiSlaveRegister(regEp, x"00", 0, v.mpsCore.mpsAppId); + axiSlaveRegister(regEp, x"00", 16, v.mpsCore.mpsEnable); + axiSlaveRegister(regEp, x"00", 17, v.mpsCore.lcls1Mode); + axiSlaveRegister(regEp, x"00", 24, v.mpsCore.mpsVersion); - axiSlaveRegisterR(regEp, x"0004", 0, toSlv(APP_CONFIG_G.BYTE_COUNT_C, 8)); - axiSlaveRegisterR(regEp, x"0004", 8, ite(APP_CONFIG_G.DIGITAL_EN_C, '1', '0')); - axiSlaveRegisterR(regEp, x"0004", 16, toSlv(APP_CONFIG_G.LCLS2_COUNT_C, 8)); - axiSlaveRegisterR(regEp, x"0004", 24, toSlv(APP_CONFIG_G.LCLS1_COUNT_C, 8)); + axiSlaveRegisterR(regEp, x"04", 0, toSlv(APP_CONFIG_G.BYTE_COUNT_C, 8)); + axiSlaveRegisterR(regEp, x"04", 8, ite(APP_CONFIG_G.DIGITAL_EN_C, '1', '0')); + axiSlaveRegisterR(regEp, x"04", 16, toSlv(APP_CONFIG_G.LCLS2_COUNT_C, 8)); + axiSlaveRegisterR(regEp, x"04", 24, toSlv(APP_CONFIG_G.LCLS1_COUNT_C, 8)); - axiSlaveRegister(regEp, x"0008", 0, v.beamDestMask); - axiSlaveRegister(regEp, x"0008", 16, v.altDestMask); + axiSlaveRegister(regEp, x"08", 0, v.beamDestMask); + axiSlaveRegister(regEp, x"08", 16, v.altDestMask); - axiSlaveRegisterR(regEp, x"000C", 0, r.mpsMsgDropCnt); - axiSlaveRegisterR(regEp, x"0010", 0, r.mpsCount); + axiSlaveRegisterR(regEp, x"0C", 0, r.mpsMsgDropCnt); + axiSlaveRegisterR(regEp, x"10", 0, r.mpsCount); - axiSlaveRegisterR(regEp, x"0014", 0, r.mpsMessage.appId(9 downto 0)); - axiSlaveRegisterR(regEp, x"0014", 10, r.mpsMessage.lcls); - axiSlaveRegisterR(regEp, x"0014", 16, r.mpsMessage.timeStamp); + axiSlaveRegisterR(regEp, x"14", 0, r.mpsMessage.appId(9 downto 0)); + axiSlaveRegisterR(regEp, x"14", 10, r.mpsMessage.lcls); + axiSlaveRegisterR(regEp, x"14", 16, r.mpsMessage.timeStamp); - axiSlaveRegisterR(regEp, x"0018", 0, r.mpsMessage.message(0)); - axiSlaveRegisterR(regEp, x"0018", 8, r.mpsMessage.message(1)); - axiSlaveRegisterR(regEp, x"0018", 16, r.mpsMessage.message(2)); - axiSlaveRegisterR(regEp, x"0018", 24, r.mpsMessage.message(3)); + axiSlaveRegisterR(regEp, x"18", 0, r.mpsMessage.message(0)); + axiSlaveRegisterR(regEp, x"18", 8, r.mpsMessage.message(1)); + axiSlaveRegisterR(regEp, x"18", 16, r.mpsMessage.message(2)); + axiSlaveRegisterR(regEp, x"18", 24, r.mpsMessage.message(3)); - axiSlaveRegisterR(regEp, x"001C", 0, r.mpsMessage.message(4)); - axiSlaveRegisterR(regEp, x"001C", 8, r.mpsMessage.message(5)); + axiSlaveRegisterR(regEp, x"1C", 0, r.mpsMessage.message(4)); + axiSlaveRegisterR(regEp, x"1C", 8, r.mpsMessage.message(5)); + + axiSlaveRegister(regEp, x"20", 0, v.rstTripValue); -- Closeout the transaction axiSlaveDefault(regEp, v.axilWriteSlave, v.axilReadSlave, AXI_RESP_DECERR_C); @@ -150,6 +155,7 @@ begin mpsCore <= r.mpsCore; beamDestMask <= r.beamDestMask; altDestMask <= r.altDestMask; + rstTripValue <= r.rstTripValue; end process comb; diff --git a/AppMps/yaml/AppMpsRegAppCh.yaml b/AppMps/yaml/AppMpsRegAppCh.yaml index 83920e76..6b3ad171 100644 --- a/AppMps/yaml/AppMpsRegAppCh.yaml +++ b/AppMps/yaml/AppMpsRegAppCh.yaml @@ -96,6 +96,22 @@ channel: &channel lsBit: 0 mode: RO description: Idle threshold table enable + mpsTripValue: + at: + offset: 4 + class: IntField + sizeBits: 32 + lsBit: 0 + mode: RO + description: analog trip value + mpsTripPulseId: + at: + offset: 8 + class: IntField + sizeBits: 64 + lsBit: 0 + mode: RO + description: Pulse ID of the analog trip value lcls1Thr: <<: *threshold at: diff --git a/AppMps/yaml/AppMpsRegBase.yaml b/AppMps/yaml/AppMpsRegBase.yaml index 1c2c7f73..f79806b0 100644 --- a/AppMps/yaml/AppMpsRegBase.yaml +++ b/AppMps/yaml/AppMpsRegBase.yaml @@ -145,3 +145,11 @@ AppMpsRegBase: &AppMpsRegBase sizeBits: 8 mode: RO description: Bytes from the last message + rstTripValue: + at: + offset: 0x20 + class: IntField + sizeBits: 1 + lsBit: 0 + mode: RW + description: Resets the analog trip values