-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
bugSomething isn't workingSomething isn't workingnext-releaseWill be part of next releaseWill be part of next releaserp2RP2350/RP2040RP2350/RP2040
Description
There is an error at the end of Period function causing wrong return from the function.
Last line of the function is:
return (16uint64(Int) + uint64(frac)) * uint64((top+1)(phc+1)1e9) / (16 * freq) // cycles = (TOP+1) * (CSRPHCorrect + 1) * (DIV_INT + DIV_FRAC/16)
The issue is caused by overflow in:
uint64((top+1)(phc+1)*1e9)
The fix is simple, the line should be:
return (16uint64(Int) + uint64(frac)) * uint64((top+1)(phc+1)) * uint64(1e9) / (16 * freq) // cycles = (TOP+1) * (CSRPHCorrect + 1) * (DIV_INT + DIV_FRAC/16)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingnext-releaseWill be part of next releaseWill be part of next releaserp2RP2350/RP2040RP2350/RP2040