-
Notifications
You must be signed in to change notification settings - Fork 3k
Add FPGA Timer feature and example test updates #11147
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
Example usage:
```
const PinList *form_factor = pinmap_ff_default_pins();
const PinList *restricted = pinmap_restricted_pins();
MbedTester tester(form_factor, restricted);
void test()
{
tester.reset();
tester.timer_init();
tester.peripherals_reset();
tester.select_peripheral(MbedTester::PeripheralTimer);
// FPGA Timer Example- count elapsed time
tester.timer_set_mode(MbedTester::TimerModeTimer);
tester.timer_reset();
tester.timer_start();
wait_ns(5000000); // 5 ms
tester.timer_stop();
printf("FPGA Timer [ns]: %llu \r\n", tester.timer_read_ns());
printf("FPGA Timer [us]: %lu \r\n", tester.timer_read_us());
printf("FPGA Timer [ms]: %lu \r\n", tester.timer_read_ms());
// FPGA Count-Down-Timer Example - perform delay
tester.timer_set_mode(MbedTester::TimerModeCountDownTimer);
tester.timer_set_delay_ms(10);
tester.timer_reset();
Timer timer;
timer.start();
tester.timer_delay();
timer.stop();
printf("Mbed Timer [us] : %i \r\n", timer.read_us());
printf("Mbed Timer [ms] : %i \r\n", timer.read_ms());
tester.timer_free();
}
```
…er instead Time Drift model.
…instead Time Drift model.
|
@mprse, thank you for your changes. |
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. 👍 Just a couple of minor flaws to resolve.
| /* | ||
| * These are the peripherals internal to the FPGA. A peripheral can be | ||
| * selected by calling MbedTester::select_peripheral. | ||
| */ |
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 comment seems out of place.
| @@ -0,0 +1,129 @@ | |||
| /* | |||
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.
The current location of this file (TESTS/mbed_hal_fpga_ci_test_shield/basic/main.cpp) is a bit misleading. I think this directory should be renamed to something like rtos-basic.
| @@ -0,0 +1,129 @@ | |||
| /* | |||
| * Copyright (c) 2013-2017, ARM Limited, All Rights Reserved | |||
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.
| * Copyright (c) 2013-2017, ARM Limited, All Rights Reserved | |
| * Copyright (c) 2013-2019, ARM Limited, All Rights Reserved |
Update the date if modified. This also applies for the following files.
| uint32_t start, stop; | ||
|
|
||
| tester.reset(); | ||
|
|
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.
A lot of empty lines here.
| tester.timer_init(); | ||
|
|
||
| tester.peripherals_reset(); | ||
|
|
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.
Empty lines.
|
|
||
| /** | ||
| * Execute programed FPGA Count Down Timer 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.
I think we should explicitly state this is a blocking call.
|
BTW, the example code is missing |
|
@mprse what is the status of this PR ? |
All review comments have been addressed. @fkjagodzinski Thanks for the review. |
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.
|
Hi @mprse are these test will require we having a new release of FPGA images? currently we are using |
|
Yes. The FPGA test shield firmware will need to be updated to run these test. |
We should make sure that one is in first. I've left a comment there to get it moving again. |
| @@ -0,0 +1,47 @@ | |||
| /* mbed Microcontroller Library | |||
| * Copyright (c) 2017-2017 ARM Limited | |||
| * | |||
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 add SPDX identifiers to new files
|
Two things to do: fix one style error and SPDX identifier for new files |
|
Fixed style and added SPDX header. It looks like its ready. |
|
Closing as requested |
Description
The following PR adds Verilog FPGA Timer implementation: ARMmbed/fpga-ci-test-shield#1 (must be merged before this one).
The intention of FPGA Timer is to have a very accurate timer to measure elapsed time or generate delays. The FPGA timer might be very useful in the timing tests, which are currently quite problematic.
Possible usage of the FPGA Timer:
Example code:
Pull request type
Reviewers
@c1728p9 @jamesbeyond @fkjagodzinski @maciejbocianski