Skip to content

Add support for iCE40 internal oscillators. #338

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

Merged
merged 3 commits into from
Mar 20, 2020
Merged

Add support for iCE40 internal oscillators. #338

merged 3 commits into from
Mar 20, 2020

Conversation

WRansohoff
Copy link
Contributor

Thanks to #nmigen on Freenode IRC; they basically wrote this for me.

…node IRC, who basically wrote this for me.
@codecov
Copy link

codecov bot commented Mar 20, 2020

Codecov Report

Merging #338 into master will increase coverage by 0.18%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #338      +/-   ##
==========================================
+ Coverage   82.54%   82.72%   +0.18%     
==========================================
  Files          35       35              
  Lines        5924     5911      -13     
  Branches     1199     1199              
==========================================
  Hits         4890     4890              
+ Misses        875      862      -13     
  Partials      159      159
Impacted Files Coverage Δ
nmigen/back/pysim.py 91.45% <0%> (+0.35%) ⬆️
nmigen/hdl/ast.py 88.46% <0%> (+1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 28f5eba...d007247. Read the comment docs.

if self.default_rst is not None:
rst_i = self.request(self.default_rst).i
else:
rst_i = Const(0)

m = Module()

# Power-on-reset domain
m.domains += ClockDomain("por", reset_less=True, local=True)
delay = int(15e-6 * self.default_clk_frequency)
Copy link
Member

Choose a reason for hiding this comment

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

Both SB_HFOSC and SB_LFOSC output is unstable for 100 µs after enabling them. So if one of these oscillators are selected, this power-on reset delay should be increased to 100 µs here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Huh, you learn something new every day. Should it have a 5x margin like the BRAM delay and be 500us, or is 100us okay?

Copy link
Member

Choose a reason for hiding this comment

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

Nope, 100 us is OK. The reason BRAM delay has a 5x margin is that the 3 us figure is experimental (i.e. typical case) rather than provided by the vendor (i.e. worst case). Since we have no idea where that delay comes from it seems wise to play it safe, but that's not needed here.

@WRansohoff
Copy link
Contributor Author

Okay, I think that should add a longer delay if an internal oscillator is selected.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@whitequark whitequark merged commit a0d2798 into amaranth-lang:master Mar 20, 2020
@whitequark
Copy link
Member

Thanks for the PR! I've merged it with minor changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants