refactor Analyzer constants to unlink dependencies

This commit is contained in:
Robert Jördens 2016-01-25 17:41:51 -07:00
parent f4c7f02127
commit cbb60337ae
3 changed files with 23 additions and 21 deletions

View File

@ -1,33 +1,15 @@
from operator import itemgetter from operator import itemgetter
from collections import namedtuple from collections import namedtuple
from itertools import count from itertools import count
from enum import Enum
import struct import struct
import logging import logging
from artiq.gateware.rtio.analyzer_common import MessageType, ExceptionType
logger = logging.getLogger(__name__) 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 = namedtuple(
"OutputMessage", "channel timestamp rtio_counter address data") "OutputMessage", "channel timestamp rtio_counter address data")

View File

@ -3,7 +3,7 @@ from migen.genlib.record import Record, layout_len
from misoc.interconnect.csr import * from misoc.interconnect.csr import *
from misoc.interconnect import stream from misoc.interconnect import stream
from artiq.coredevice.analyzer import MessageType, ExceptionType from artiq.gateware.rtio.analyzer_common import MessageType, ExceptionType
__all__ = ["Analyzer"] __all__ = ["Analyzer"]

View File

@ -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