-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug #309 #310
base: master
Are you sure you want to change the base?
Fix bug #309 #310
Conversation
@@ -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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
This looks great up to a minor comment and the fact that the tests are failing. That might be a problem with the test server though. |
@@ -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) |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Where applicable, swap the position of filterStretchLen and filterStretchAt to be consistent with the regRun method definition.
regs = self.regRun(self, self.RUN_MODE_AVERAGE_AUTO, 1, filterFunc, | ||
filterStretchLen, filterStretchAt, demods) | ||
|
||
regs = self.regRun(self, mode=self.RUN_MODE_AVERAGE_AUTO, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, this is just wrong. We're calling regRun
, a classmethod, through an instance of that class, and then passing an unneccessary self reference as the first argument. I realize you didn't create the issue here, but it stands out that this needs to be fixed. I'll file a separate issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see quite a few things in the code that do not really look great to me. However, I keep in mind the following: (1) I'm not 100% familiar with the code, there might be tricky, uncommented bug fixes, not obviously standing out in the commit history; (2) the code works for your group; (3) we would love to see our core code synced with yours to benefit from all future updates. It seems that the right way for us to act is to ask for the minimum number of changes that should do the job for us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please post issues. It's perfectly fine to post an issue just asking why a bit of code is a certain way (we even have a "question" label for issues).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I was being a bit overdramatic about classmethods. We should just remove the first self
argument to the method. If you can do that here while you're touching these lines, @patzinak, that'd be great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been addressed in a corresponding commit.
LGTM, but @DanielSank do you still want to have @jrainbo look at it? |
It would be really nice if he could look at the circuit diagram and just check that the dclk bits variable here agrees. I say this based on the following excerpt from #301
|
I'd say that I'm sure that these bits carry useful information. This is according to _documentationGHzAD_v4.doc and due to the fact that I saw them being perfectly correlated with the LED[1] status. The documentation says:
The documentation, however, does not tell how to interpret these bits (unlike in the case with I had to come up with an interpretation and I believe that all bits should return ones when everything works correctly, however, this assumption/guess is not reflected in the code in any way because this is not documented. |
Yes, exactly. This is the right time to just figure it out and get it right here in the code. @jrainbo By "get it right" I mean "name the variable something that makes sense, given the hardware meaning of the register bits". |
Sure, that would be great! Is @jrainbo getting the notifications? |
Not sure. I may have to try notification via air phonons. |
It might be good to bump the version number at https://github.com/martinisgroup/servers/blob/master/ghz_fpga_server.py#L180. |
This has been added to the brunch per @maffoo suggestion.
This server heavily relays upon fpgalib.adc. This warrants a bug fix version number bump.
See bug #309 separated from issue #301.