Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions fpgalib/adc.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ def registerReadback(self):
@inlineCallbacks
def func():
# build registry packet
regs = self.regRun(self.RUN_MODE_REGISTER_READBACK, 0) # 0 reps?
regs = self.regRun(self.RUN_MODE_REGISTER_READBACK, {}, 0)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use named params here to help the reader:

regs = self.regRun(self.RUN_MODE_REGISTER_READBACK, info={}, reps=0)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming of the params is a good idea here but this should be done in a consistent way across the module. Should I add a commit that adds param names info and reps to all self.regRun() calls in the module?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be a good idea to add param names throughout the module. Note that the param names for build1 and build7 are different.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, this should be reviewed.


p = self.makePacket("registerReadback")
p.write(regs.tostring())
Expand Down Expand Up @@ -1052,7 +1052,8 @@ def processReadback(resp):
a = np.fromstring(resp, dtype='<u1')
return {
'build': a[0],
'noPllLatch': a[1]&1 == 1,
'noPllLatch': bool(a[1] & 1),
'dClkBits': a[1] >> 1 & 0b1111,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would really like it if @jrainbo could verify this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can never remember the preference of operators. I'd prefer to be explicit:

'dClkBits': (a[1] >> 1) & 0b1111,

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

'executionCounter': int(a[2]) + int(a[3] << 8),
'nPackets': a[4],
'badPackets': a[5]
Expand Down