From cbb60337ae076b55175bf6e297720dd17a3d7828 Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Mon, 25 Jan 2016 17:41:51 -0700 Subject: [PATCH] refactor Analyzer constants to unlink dependencies --- artiq/coredevice/analyzer.py | 22 ++-------------------- artiq/gateware/rtio/analyzer.py | 2 +- artiq/gateware/rtio/analyzer_common.py | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 21 deletions(-) create mode 100644 artiq/gateware/rtio/analyzer_common.py diff --git a/artiq/coredevice/analyzer.py b/artiq/coredevice/analyzer.py index 16903f5cf..778a3750b 100644 --- a/artiq/coredevice/analyzer.py +++ b/artiq/coredevice/analyzer.py @@ -1,33 +1,15 @@ from operator import itemgetter from collections import namedtuple from itertools import count -from enum import Enum import struct import logging +from artiq.gateware.rtio.analyzer_common import MessageType, ExceptionType + logger = logging.getLogger(__name__) -class MessageType(Enum): - output = 0b00 - input = 0b01 - exception = 0b10 - - -class ExceptionType(Enum): - reset_rising = 0b000000 - reset_falling = 0b000001 - reset_phy_rising = 0b000010 - reset_phy_falling = 0b000011 - - o_underflow_reset = 0b010000 - o_sequence_error_reset = 0b010001 - o_collision_error_reset = 0b010010 - - i_overflow_reset = 0b100000 - - OutputMessage = namedtuple( "OutputMessage", "channel timestamp rtio_counter address data") diff --git a/artiq/gateware/rtio/analyzer.py b/artiq/gateware/rtio/analyzer.py index b775aa14e..e2e196543 100644 --- a/artiq/gateware/rtio/analyzer.py +++ b/artiq/gateware/rtio/analyzer.py @@ -3,7 +3,7 @@ from migen.genlib.record import Record, layout_len from misoc.interconnect.csr import * from misoc.interconnect import stream -from artiq.coredevice.analyzer import MessageType, ExceptionType +from artiq.gateware.rtio.analyzer_common import MessageType, ExceptionType __all__ = ["Analyzer"] diff --git a/artiq/gateware/rtio/analyzer_common.py b/artiq/gateware/rtio/analyzer_common.py new file mode 100644 index 000000000..440c3b593 --- /dev/null +++ b/artiq/gateware/rtio/analyzer_common.py @@ -0,0 +1,20 @@ +from enum import Enum + + +class MessageType(Enum): + output = 0b00 + input = 0b01 + exception = 0b10 + + +class ExceptionType(Enum): + reset_rising = 0b000000 + reset_falling = 0b000001 + reset_phy_rising = 0b000010 + reset_phy_falling = 0b000011 + + o_underflow_reset = 0b010000 + o_sequence_error_reset = 0b010001 + o_collision_error_reset = 0b010010 + + i_overflow_reset = 0b100000