Skip to content

Commit

Permalink
Merge pull request #408 from slaclab/pre-release
Browse files Browse the repository at this point in the history
Release Candidate v5.1.0
  • Loading branch information
ruck314 authored Jul 1, 2024
2 parents d745533 + 6d976cd commit a541008
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 35 deletions.
4 changes: 2 additions & 2 deletions AmcCarrierCore/core/AmcCarrierPkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
42 changes: 31 additions & 11 deletions AppMps/rtl/AppMpsEncoder.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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

Expand All @@ -101,6 +108,9 @@ architecture mapping of AppMpsEncoder is

message(config.BYTE_MAP_C)(bitPos) := '1';

tripValue := value;
tripPulseId := pulseIdIn;

end if;
end procedure;

Expand All @@ -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";
Expand Down Expand Up @@ -155,6 +166,9 @@ begin
axilWriteSlave => axilWriteSlave,
mpsMessage => r.mpsMessage,
mpsMsgDrop => mpsMsgDrop,
mpsTripValue => r.mpsTripValue,
tripPulseId => r.tripPulseId,
rstTripValue => rstTripValue,
mpsAppRegisters => mpsReg);

---------------------------------
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions AppMps/rtl/AppMpsReg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -103,6 +106,7 @@ begin
-- MPS message monitoring
mpsMessage => mpsMessage,
mpsMsgDrop => mpsMsgDrop,
rstTripValue => rstTripValue,
-- MPS Configuration Registers
mpsCore => mpsAppRegisters.mpsCore,
beamDestMask => mpsAppRegisters.beamDestMask,
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 9 additions & 1 deletion AppMps/rtl/AppMpsRegAppCh.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
48 changes: 27 additions & 21 deletions AppMps/rtl/AppMpsRegBase.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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'),
Expand Down Expand Up @@ -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);
Expand All @@ -150,6 +155,7 @@ begin
mpsCore <= r.mpsCore;
beamDestMask <= r.beamDestMask;
altDestMask <= r.altDestMask;
rstTripValue <= r.rstTripValue;

end process comb;

Expand Down
16 changes: 16 additions & 0 deletions AppMps/yaml/AppMpsRegAppCh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions AppMps/yaml/AppMpsRegBase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a541008

Please sign in to comment.