Skip to content

Commit

Permalink
ENH: add MMC3 firmware version readback
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickDieter committed Jan 9, 2018
1 parent 9356697 commit 072be2c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
27 changes: 26 additions & 1 deletion firmware/src/mmc3_m26_eth.v
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

localparam VERSION = 8'd01;

module mmc3_m26_eth(
input wire RESET_N,
Expand Down Expand Up @@ -341,6 +341,31 @@ localparam M26_RX_HIGHADDR = 32'ha00f-1;
localparam GPIO_BASEADDR = 32'hb000;
localparam GPIO_HIGHADDR = 32'hb01f;


// VERSION READBACk
reg [7:0] BUS_DATA_OUT_REG;
always @ (posedge BUS_CLK) begin
if(BUS_RD) begin
if(BUS_ADD == 0)
BUS_DATA_OUT_REG <= VERSION[7:0];
//else if(BUS_ADD == 1)
// BUS_DATA_OUT_REG <= VERSION[15:8];
//else if(BUS_ADD == 2)
//BUS_DATA_OUT_REG <= BOARD[7:0];
//else if(BUS_ADD == 3)
//BUS_DATA_OUT_REG <= BOARD[15:8];
end
end

reg READ_VER;
always @ (posedge BUS_CLK)
if(BUS_RD & BUS_ADD < 2)
READ_VER <= 1;
else
READ_VER <= 0;

assign BUS_DATA[7:0] = READ_VER ? BUS_DATA_OUT_REG : 8'hzz;


// ------- USER MODULES ------- //
///////////////////// M26 JTAG
Expand Down
13 changes: 8 additions & 5 deletions pymosa/m26.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class m26(Dut):
Note:
Setup run and trigger in configuration file (e.g. configuration.yaml)
'''

VERSION = 1 # required version for mmc3_m26_eth.v

def __init__(self, conf=None, context=None, socket_address=None):
self.meta_data_dtype = np.dtype([('index_start', 'u4'), ('index_stop', 'u4'), ('data_length', 'u4'),
('timestamp_start', 'f8'), ('timestamp_stop', 'f8'), ('error', 'u4')])
Expand All @@ -91,11 +94,11 @@ def __init__(self, conf=None, context=None, socket_address=None):
def init(self, **kwargs):
super(m26, self).init()

# TODO: version control
# fw_version = self['intf'].read(0x2000, 1)[0]
# logging.info("MMC3 firmware version: %s" % (fw_version))
# if fw_version != self.VERSION:
# raise Exception("MMC3 firmware version does not satisfy version requirements (read: %s, require: %s)" % (fw_version, self.VERSION))
# check firmware version
fw_version = self['ETH'].read(0x0000, 1)[0]
logging.info("MMC3 firmware version: %s" % (fw_version))
if fw_version != self.VERSION:
raise Exception("MMC3 firmware version does not satisfy version requirements (read: %s, require: %s)" % (fw_version, self.VERSION))

logging.info('Initializing %s', self.__class__.__name__)

Expand Down

0 comments on commit 072be2c

Please sign in to comment.