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

[Feature] always_* blocks inside interface #947

Closed
taichi-ishitani opened this issue Sep 6, 2024 · 4 comments · Fixed by #950
Closed

[Feature] always_* blocks inside interface #947

taichi-ishitani opened this issue Sep 6, 2024 · 4 comments · Fixed by #950
Labels
lang Language design

Comments

@taichi-ishitani
Copy link
Contributor

taichi-ishitani commented Sep 6, 2024

SV interface can have always_* blocks.
Veryl should also support this feature.

refs: #908

@taichi-ishitani
Copy link
Contributor Author

AssignDeclaration should also be supported.

@dalance
Copy link
Collaborator

dalance commented Sep 8, 2024

I have no experience of these usage. Could you explain actual use case?

@taichi-ishitani
Copy link
Contributor Author

taichi-ishitani commented Sep 8, 2024

For example, ack logic is commnly used for handshake protocols.
By supporting this feature, this ack logic can be declared in an interface like below.

interface foo_if;
  logic       ready;
  logic       valid;
  logic [7:0] data;
  logic       ack;

  always_comb ack = ready && valid;

  modport master (
    input  ready,
    output valid,
    output data,
    input  ack
  );

  modport slave (
    output ready,
    input  valid,
    input  data,
    input  ack
  );
endinterface

And it can be used like below.

always_ff @(posedge i_clk) begin
  if (foo_if.ack) begin
    data <= foo_if.data;
  end
end

I think this feature can help to increase readability and maintainability.

@dalance dalance added the lang Language design label Sep 9, 2024
@dalance
Copy link
Collaborator

dalance commented Sep 9, 2024

Thanks!
I understood the use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang Language design
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants