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

[dv,jtag] Change JTAG clock frequency to 24MHz #24580

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

sha-ron
Copy link
Contributor

@sha-ron sha-ron commented Sep 16, 2024

The current configured frequency of 50MHz is too fast and might not be supported by silicin.

@sha-ron sha-ron requested a review from a team as a code owner September 16, 2024 16:10
@sha-ron sha-ron requested review from rswarbrick and removed request for a team September 16, 2024 16:10
@sha-ron
Copy link
Contributor Author

sha-ron commented Sep 16, 2024

he current configured frequency of 50MHz is too fast and might not be supported by silicon.

// jtag interface with default 50MHz tck
interface jtag_if #(parameter int unsigned JtagDefaultTckPeriodPs = 20_000) ();
// jtag interface with default 24MHz tck
interface jtag_if #(parameter int unsigned JtagDefaultTckPeriodPs = 41_664) ();
Copy link
Contributor

Choose a reason for hiding this comment

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

Not that it necessarily matters for this round, but... This merely changes the defaults for a parameter. Shouldn't the value for earlgrey be set in some using module or elsewhere via the DV environment?

Copy link
Contributor

Choose a reason for hiding this comment

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

For example, at these sites:

jtag_if jtag_if();

jtag_if flash_ctrl_jtag_if();

However, if we end up setting the value in any sequences, then this would get overridden anyway. It looks like we only do that in block-level tests right now, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I agree it might be good to do it differently at later stage. For now I tried to minimize the changes as much as possible.

@rswarbrick
Copy link
Contributor

What situation are you using this DV code in? Are you really sure that the numbers you change here have the effect you expect? For example, in the rv_dm block tests, the frequency is randomised to be between 1MHz and 10MHz. (See rv_dm_base_vseq.sv)

@sha-ron
Copy link
Contributor Author

sha-ron commented Sep 17, 2024

It failed during gate-level simulation since 50MHz frequency is too fast and is not supported. 24MHz is supported and works fine.

@rswarbrick
Copy link
Contributor

rswarbrick commented Sep 17, 2024

Ah, I see. Presumably you are instantiating the interface in gate-level simulation with some code that configures it. The easiest approach is probably to choose a "GLS-suitable frequency" there.

@sha-ron
Copy link
Contributor Author

sha-ron commented Sep 17, 2024

I don't have special tests, I am using existing tests like rom_raw_unlock in which the JTAG frequency is set by this interface. But maybe indeed it will be simpler to do the change under `ifdef GATE_LEVEL?

@rswarbrick
Copy link
Contributor

Ah right, now I think I understand. If I've followed this correctly, the instantiation of jtag_if comes from chip_if.sv, line 437.

For some bizarre reason, the original author of this interface made it "active", so that it drives its own TCK signal based on a configured frequency. Honestly, I think this is mad! But changing that is not a problem for today :-)

Looking a bit further (grepping for jtag_if!), I see that in the DV environment, it gets wired up to a UVM agent in chip_if.sv, line 985. Oddly, that agent doesn't configure the JTAG frequency itself. At block level, the lc_ctrl and rv_dm tests do configure it (in the env for lc_ctrl and the base vseq for rv_dm).

I think we should probably be a little more explicit in DV land ("my chip JTAG frequency is XYZ"), but that's not really a problem for today either! But it would be nice to keep the fast-ish JTAG frequency in DV simulations: they are painfully slow already! If you can stick it under an ifdef GATE_LEVEL that would be perfect. Possibly with a TODO comment reminding us to clean things up!

@sha-ron
Copy link
Contributor Author

sha-ron commented Sep 19, 2024

Yes, I agree the configuration should be done through a UVM agent. For now I added it under `ifdef GATE_LEVEL with a TODO comment.

Signed-off-by: Sharon Topaz <[email protected]>

[dv,jtag] Change JTAG clock frequency to 24MHz for GLS

Signed-off-by: Sharon Topaz <[email protected]>
@rswarbrick
Copy link
Contributor

Thanks for this. I've just opened an issue about the fact this needs sorting out and have force-pushed to this PR with a link to it. Merging without waiting for CI to run again (the diff shows I've just added a token to a comment!)

@rswarbrick rswarbrick merged commit 7bd9109 into lowRISC:master Sep 19, 2024
5 of 15 checks passed
@sha-ron
Copy link
Contributor Author

sha-ron commented Sep 19, 2024

Thank you for your help @rswarbrick .

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.

3 participants