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 support for some clock and reset pragmas to Classic #624

Merged
merged 6 commits into from
Oct 13, 2023

Conversation

nanavati
Copy link
Collaborator

@nanavati nanavati commented Oct 11, 2023

This includes support for gate_input_clocks, clock_family, clock_prefix, reset_prefix and gate_prefix. Partially addresses #224 and fixes #616

Move existing Pragmas.bs test there.
Add test cases for gate_input_clocks and clock_family pragmas in Classic.
…x pragmas.

Add a testcase for the prefix pragmas.
Check for duplicate prefix pragmas in PragmaCheck because, unlike BSV,
the Classic parser lets duplicate pragmas through.
Add testcases for the duplicate pragma check.
Copy link
Collaborator

@quark17 quark17 left a comment

Choose a reason for hiding this comment

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

This is awesome, thanks!

src/comp/PragmaCheck.hs Outdated Show resolved Hide resolved
{-# synthesize mkClockFamily {
gate_input_clocks = { default_clock },
clock_family = { default_clock, ungated } } #-}
mkClockFamily :: (IsModule m mType) => Clock -> m Ticked
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's minor, but do you want to name the module with sys instead of mk? It would require also renaming the expected Verilog file? (And the same for NoClockFamily.bs.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought we mainly used sys for top-level testbenches and the like. I used mk here because I made a component meant to be instantiated in something larger.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I will merge the PR as it is now; I don't want to keep making work for you. But to answer your question: I guess I don't see the difference between this module named mk and all the other test files with modules named sys. I don't see how either is more or less a submodule versus a top module. I guess it really only matters for commands that expect a top-module (like test_c_veri_bs) and here we're just using compile_verilog_pass, but I tend to use the same structure even when I'm not using test_*, of making the top (or only) module in the file be named with sys, which is why I found this use of mk odd (plus the inconsistency with the other files, which are also not using test_*, but still named sys).

testsuite/bsc.syntax/bh/bh_pragmas/UnknownClockFamily.bs Outdated Show resolved Hide resolved
…ibute

error message.

Check for the correct pragma in the compiler output for the error tests.
GateUnknownClock and UnknownClockFamily tests.
@quark17 quark17 merged commit af603ae into B-Lang-org:main Oct 13, 2023
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants