Skip to content
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

Add event management primitives #12

Merged
merged 1 commit into from Jun 9, 2020
Merged

Conversation

jfng
Copy link
Member

@jfng jfng commented Mar 24, 2020

Follow-up of #11, about decoupling event management from peripherals.

Events (represented by the EventSource class) can be gathered in an InterruptSource in order to generate interrupt requests. The interrupt source exposes an IRQ line, and is controlled by three CSRs: status, pending and enable.

@jfng
Copy link
Member Author

jfng commented Mar 31, 2020

Updates:

  • added an EventMap class for metadata
  • EventSourceevent.Source
  • InterruptSourceevent.Monitor

@codecov
Copy link

codecov bot commented Mar 31, 2020

Codecov Report

Merging #12 into master will increase coverage by 0.36%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master       #12      +/-   ##
===========================================
+ Coverage   99.63%   100.00%   +0.36%     
===========================================
  Files           4         5       +1     
  Lines         552       630      +78     
  Branches      127       140      +13     
===========================================
+ Hits          550       630      +80     
+ Misses          1         0       -1     
+ Partials        1         0       -1     
Impacted Files Coverage Δ
nmigen_soc/event.py 100.00% <100.00%> (ø)
nmigen_soc/memory.py 100.00% <0.00%> (ø)
nmigen_soc/csr/wishbone.py 100.00% <0.00%> (ø)
nmigen_soc/wishbone/bus.py 100.00% <0.00%> (+1.02%) ⬆️

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 967a65f...5d77efa. Read the comment docs.

@jfng jfng changed the title event: add EventSource and InterruptSource. Add event management primitives Mar 31, 2020
], name=name, src_loc_at=1 + src_loc_at)

# FIXME: get rid of this
__hash__ = object.__hash__
Copy link
Member Author

Choose a reason for hiding this comment

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

This uses the same workaround as csr.Element, because EventMap stores event sources as keys of a dict.

@whitequark
Copy link
Member

I like the naming change a lot! I'll try to review this tomorrow.

Copy link
Member

@whitequark whitequark left a comment

Choose a reason for hiding this comment

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

Looks good overall.

One suggestion I would make is to have the Monitor provide a Source so you can stack them. (Quite a few SoCs have these hierarchies of interrupts, usually no more than 2-deep.)

----------
event_map : :class:`EventMap`
Event map.
enable : Signal(event_map.size), one-hot, in
Copy link
Member

Choose a reason for hiding this comment

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

Are all of these actually one-hot? Not bit masks?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, reworded it.

@jfng
Copy link
Member Author

jfng commented Apr 14, 2020

One suggestion I would make is to have the Monitor provide a Source so you can stack them. (Quite a few SoCs have these hierarchies of interrupts, usually no more than 2-deep.)

I updated the Monitor to do so. As a consequence, EventMaps are now (optionally) assigned to Sources in order to support iterating over a hierarchy of events.

@whitequark whitequark merged commit 4a6a948 into amaranth-lang:master Jun 9, 2020
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