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 init parameter to Timeout #1207

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

andreasWallner
Copy link
Collaborator

Resurrection of an older PR...

Context, Motivation & Description

Currently Timeout is initialized to be False.
This can for sure be changed with init like this:

val t = Timeout(5)
t.init(True)

(which will produce slightly ugly verilog with two reset statements, but work)

But it feels different from other things, i.e. this doesn't do what one might initially assume: val t = Timeout(5) init True (changes type of t).

This change adds a parameter, making it feel more like other library components or functions like e.g. rise

RTD change tbd.

Impact on code generation

None

@Dolu1990
Copy link
Member

hmm, adding the following to the Timeout class :

  def init(value : Bool): this.type = {
    state.removeInitAssignments()
    state.init(value)
    this
  }

would work cleanly.
Allowing a :

    val t = Timeout(5) init(True)    

What about doing things like this ?

@andreasWallner
Copy link
Collaborator Author

sure, just saw that some other utilities use the same

@Dolu1990 Dolu1990 merged commit 73fa6eb into SpinalHDL:dev Sep 27, 2023
12 checks passed
@Dolu1990
Copy link
Member

<3

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.

None yet

2 participants