Skip to content

Add event management primitives - #12

Merged
whitequark merged 1 commit into
amaranth-lang:masterfrom
megng1:event
Jun 9, 2020
Merged

whitequark merged 1 commit into
amaranth-lang:masterfrom
megng1:event

Conversation

@megng1

@megng1 megng1 commented Mar 24, 2020

Copy link
Copy Markdown
Member

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.

@megng1

megng1 commented Mar 31, 2020

Copy link
Copy Markdown
Member Author

Updates:

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

@codecov

codecov Bot commented Mar 31, 2020

Copy link
Copy Markdown

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.

@megng1 megng1 changed the title event: add EventSource and InterruptSource. Add event management primitives Mar 31, 2020
Comment thread nmigen_soc/event.py
], name=name, src_loc_at=1 + src_loc_at)

# FIXME: get rid of this
__hash__ = object.__hash__

Copy link
Copy Markdown
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
Copy Markdown
Member

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

@whitequark whitequark left a comment

Copy link
Copy Markdown
Member

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.)

Comment thread nmigen_soc/event.py Outdated
----------
event_map : :class:`EventMap`
Event map.
enable : Signal(event_map.size), one-hot, in

Copy link
Copy Markdown
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
Copy Markdown
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.

@megng1

megng1 commented Apr 14, 2020

Copy link
Copy Markdown
Member Author

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.

2 participants