Skip to content

Commit

Permalink
Merge pull request #1225 from slaclab/EventFrameSequencerMux
Browse files Browse the repository at this point in the history
Event Frame Sequencer Protocol development
  • Loading branch information
ruck314 authored Jan 23, 2025
2 parents e1130e1 + dc20d0e commit 6559b1d
Show file tree
Hide file tree
Showing 10 changed files with 1,785 additions and 1 deletion.
405 changes: 405 additions & 0 deletions protocols/event-frame-sequencer/rtl/EventFrameSequencerDemux.vhd

Large diffs are not rendered by default.

507 changes: 507 additions & 0 deletions protocols/event-frame-sequencer/rtl/EventFrameSequencerMux.vhd

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions protocols/event-frame-sequencer/ruckus.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Load RUCKUS library
source $::env(RUCKUS_PROC_TCL)

# Load Source Code
loadSource -lib surf -dir "$::DIR_PATH/rtl"

# Load Simulation
loadSource -lib surf -sim_only -dir "$::DIR_PATH/tb"
365 changes: 365 additions & 0 deletions protocols/event-frame-sequencer/tb/EventFrameSequencerTb.vhd

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions protocols/ruckus.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ source $::env(RUCKUS_PROC_TCL)

# Load ruckus files
loadRuckusTcl "$::DIR_PATH/batcher"
loadRuckusTcl "$::DIR_PATH/event-frame-sequencer"
loadRuckusTcl "$::DIR_PATH/hamming-ecc"
loadRuckusTcl "$::DIR_PATH/i2c"
loadRuckusTcl "$::DIR_PATH/jesd204b"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(
self.add(pr.RemoteVariable(
name = "State",
description = "current state of FSM (for debugging)",
offset = 0xFF8,
offset = 0xFF4,
bitSize = 1,
bitOffset = 8,
mode = "RO",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
#-----------------------------------------------------------------------------
# This file is part of the '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 the '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.
#-----------------------------------------------------------------------------

import pyrogue as pr

class EventFrameSequencerDemux(pr.Device):
def __init__(
self,
numberSlaves = 1,
**kwargs):
super().__init__(**kwargs)

self.addRemoteVariables(
name = 'DataCnt',
description = 'Increments every time a data frame is received',
offset = 0x000,
bitSize = 32,
mode = 'RO',
number = numberSlaves,
stride = 4,
pollInterval = 1,
)

self.add(pr.RemoteVariable(
name = 'SeqCnt',
description = 'Increments every time there is a frame sent',
offset = 0xFBC,
bitSize = 8,
mode = 'RO',
pollInterval = 1,
))

self.add(pr.RemoteVariable(
name = 'DropCnt',
description = 'Increments every time a frame is dropped',
offset = 0xFC0,
bitSize = 32,
mode = 'RO',
pollInterval = 1,
))

self.add(pr.RemoteVariable(
name = 'NUM_MASTERS_G',
description = 'NUM_MASTERS_G generic value',
offset = 0xFF4,
bitSize = 8,
mode = 'RO',
disp = '{:d}',
))

self.add(pr.RemoteVariable(
name = "State",
description = "current state of FSM (for debugging)",
offset = 0xFF4,
bitSize = 1,
bitOffset = 8,
mode = "RO",
pollInterval = 1,
enum = {
0x0: 'IDLE_S',
0x1: 'MOVE_S',
},
))

self.add(pr.RemoteVariable(
name = "BlowoffExt",
description = "Status of external blowoff input",
offset = 0xFF4,
bitSize = 1,
bitOffset = 16,
base = pr.Bool,
mode = "RO",
pollInterval = 1,
))

self.add(pr.RemoteVariable(
name = "HdrError",
description = "Header error code when last frame dropped",
offset = 0xFF4,
bitSize = 8,
bitOffset = 24,
mode = "RO",
pollInterval = 1,
))

self.add(pr.RemoteVariable(
name = "Blowoff",
description = "Blows off the inbound AXIS stream (for debugging)",
offset = 0xFF8,
bitSize = 1,
bitOffset = 0,
base = pr.Bool,
mode = "RW",
))

self.add(pr.RemoteCommand(
name = "CntRst",
description = "",
offset = 0xFFC,
bitSize = 1,
bitOffset = 0,
function = pr.BaseCommand.toggle,
))

self.add(pr.RemoteCommand(
name = "TimerRst",
description = "",
offset = 0xFFC,
bitSize = 1,
bitOffset = 1,
function = pr.BaseCommand.toggle,
))

self.add(pr.RemoteCommand(
name = "HardRst",
description = "",
offset = 0xFFC,
bitSize = 1,
bitOffset = 2,
function = pr.BaseCommand.toggle,
))

self.add(pr.RemoteCommand(
name = "SoftRst",
description = "",
offset = 0xFFC,
bitSize = 1,
bitOffset = 3,
function = pr.BaseCommand.toggle,
))

def hardReset(self):
self.HardRst()

def initialize(self):
self.SoftRst()

def countReset(self):
self.CntRst()
152 changes: 152 additions & 0 deletions python/surf/protocols/event_frame_sequencer/_EventFrameSequencerMux.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
#-----------------------------------------------------------------------------
# This file is part of the '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 the '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.
#-----------------------------------------------------------------------------

import pyrogue as pr

class EventFrameSequencerMux(pr.Device):
def __init__(
self,
numberSlaves = 1,
**kwargs):
super().__init__(**kwargs)

self.addRemoteVariables(
name = 'DataCnt',
description = 'Increments every time a data frame is received',
offset = 0x000,
bitSize = 32,
mode = 'RO',
number = numberSlaves,
stride = 4,
pollInterval = 1,
)

self.add(pr.RemoteVariable(
name = 'SeqCnt',
description = 'Increments every time there is a frame sent',
offset = 0xFBC,
bitSize = 8,
mode = 'RO',
pollInterval = 1,
))

self.add(pr.RemoteVariable(
name = 'TransactionCnt',
description = 'Increments every time a transition frame is received',
offset = 0xFC0,
bitSize = 32,
mode = 'RO',
pollInterval = 1,
))

self.add(pr.RemoteVariable(
name = 'TRANS_TDEST_G',
description = 'TRANS_TDEST_G generic value',
offset = 0xFC4,
bitSize = 8,
mode = 'RO',
))

self.add(pr.RemoteVariable(
name = 'Bypass',
description = 'Mask to bypass a channel',
offset = 0xFD0,
bitSize = numberSlaves,
mode = 'RW',
))

self.add(pr.RemoteVariable(
name = 'NUM_SLAVES_G',
description = 'NUM_SLAVES_G generic value',
offset = 0xFF4,
bitSize = 8,
mode = 'RO',
disp = '{:d}',
))

self.add(pr.RemoteVariable(
name = "State",
description = "current state of FSM (for debugging)",
offset = 0xFF4,
bitSize = 1,
bitOffset = 8,
mode = "RO",
pollInterval = 1,
enum = {
0x0: 'IDLE_S',
0x1: 'MOVE_S',
},
))

self.add(pr.RemoteVariable(
name = "BlowoffExt",
description = "Status of external blowoff input",
offset = 0xFF4,
bitSize = 1,
bitOffset = 16,
base = pr.Bool,
mode = "RO",
pollInterval = 1,
))

self.add(pr.RemoteVariable(
name = "Blowoff",
description = "Blows off the inbound AXIS stream (for debugging)",
offset = 0xFF8,
bitSize = 1,
bitOffset = 0,
base = pr.Bool,
mode = "RW",
))

self.add(pr.RemoteCommand(
name = "CntRst",
description = "",
offset = 0xFFC,
bitSize = 1,
bitOffset = 0,
function = pr.BaseCommand.toggle,
))

self.add(pr.RemoteCommand(
name = "TimerRst",
description = "",
offset = 0xFFC,
bitSize = 1,
bitOffset = 1,
function = pr.BaseCommand.toggle,
))

self.add(pr.RemoteCommand(
name = "HardRst",
description = "",
offset = 0xFFC,
bitSize = 1,
bitOffset = 2,
function = pr.BaseCommand.toggle,
))

self.add(pr.RemoteCommand(
name = "SoftRst",
description = "",
offset = 0xFFC,
bitSize = 1,
bitOffset = 3,
function = pr.BaseCommand.toggle,
))

def hardReset(self):
self.HardRst()

def initialize(self):
self.SoftRst()

def countReset(self):
self.CntRst()
2 changes: 2 additions & 0 deletions python/surf/protocols/event_frame_sequencer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from surf.protocols.event_frame_sequencer._EventFrameSequencerMux import *
from surf.protocols.event_frame_sequencer._EventFrameSequencerDemux import *
Loading

0 comments on commit 6559b1d

Please sign in to comment.