-
Notifications
You must be signed in to change notification settings - Fork 8
Add FPGA Timer/CountDownTimer feature #1
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
Conversation
| end else begin | ||
| counter <= count_down_value; | ||
| end | ||
| end else begin |
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.
| end else begin | |
| end else begin |
Wrong indentation.
rtl/timer.v
Outdated
|
|
||
| // Timer module | ||
| // | ||
| // This module counts elapsed time or perform the delay |
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 module counts elapsed time or perform the delay | |
| // This module counts elapsed time or performs the delay |
rtl/timer.v
Outdated
| end | ||
| end else begin | ||
| if (mode == MODE_TIMER) begin | ||
| if (enable == 1'b1) begin |
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.
Current code increments the counter whenever the enable pin is high. This is OK, however I'd like to see a setting that would modify this behavior so the measurement would stop on the first falling edge. This way we could choose to measure the sum of enable high states or just the first pulse.
|
Starting CI. |
|
@mprse Can we proceed to unblock Mbed OS PR ? |
@fkjagodzinski Are you happy with the last changes? |
What changes? Nothing has changed since my review. |
I added the requested option, to count only the first pulse.
Even with this one is merged. PR ARMmbed/mbed-os#11147 will have to wait for the FPGA-test-shield firmware version update and this is planned next year I think. |
Dang, that is far way. We shall close 11147 and keep in opened in jira as internal ticket with branch available to continue this work the next year? |
fkjagodzinski
left a comment
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.
Looks good. 👍
| if (mode == MODE_TIMER) begin | ||
| if (enable == 1'b1 && count_once_reg == 1'b1) begin | ||
| counter <= counter + 1; | ||
| end | ||
|
|
||
| if (count_once == 1'b1 && negedge_enable == 1'b1) begin | ||
| count_once_reg <= 1'b0; | ||
| end |
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 found the count_once_reg name a bit misleading as I assumed a not-inverted logic here. Consider renaming to something like counting_enabled.
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.
Fixed
This PR adds Verilog implementation for FPGA Timer which can be used in two modes:
The accuracy of the FPGA Timer is 10 ns: 1 timer tick corresponds to 10 ns.
The mbed OS part of the PR:
ARMmbed/mbed-os#11147