Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add Verilog reserved word: wait #2321

Closed
polybeandip opened this issue Oct 29, 2024 · 2 comments · Fixed by #2322
Closed

Add Verilog reserved word: wait #2321

polybeandip opened this issue Oct 29, 2024 · 2 comments · Fixed by #2322
Labels

Comments

@polybeandip
Copy link
Collaborator

polybeandip commented Oct 29, 2024

Here's an example program, where we name a cell wait:

# making a cell named "wait"
import "primitives/core.futil";

component main() -> () {
  cells {
    wait = std_reg(32);
    add = std_add(32);
  }
  wires {
   static<1> group write {
     add.left = wait.out;
     add.right = 32'd1;
     wait.write_en = 1'b1;
     wait.in = add.out;
   }
  }
  control {
      write;
  }
}

Running this with fud exec <file_name>.futil --to dat --through verilog yields

[fud] ERROR: `/opt/verilator/bin/verilator --trace /tmp/tmpcsy0je3b /scratch/ad739/calyx/fud/icarus/tb.sv --binary --top-module toplevel --Mdir /tmp/tmpq176rkir -fno-inline>&2' failed:
=====STDERR=====
%Error: /tmp/tmpcsy0je3b:355:3: syntax error, unexpected wait, expecting IDENTIFIER or randomize
  355 | ) wait (
      |   ^~~~
%Error: Exiting due to 1 error(s)

=====STDOUT=====

Perhaps this kind of code should produce a Calyx error instead of a Verilator one? This way the Calyx isn't producing malformed Verilog code.

@polybeandip
Copy link
Collaborator Author

polybeandip commented Oct 29, 2024

Oops, looks like there's already a file that handles these kinds issues. Adding wait (and, another one I found, break) to reserved_names.rs should do the trick. I'll make a quick PR by tonight!

@rachitnigam
Copy link
Contributor

@polybeandip can you link the PR to this issue when you have one? I'm going to mark the issue stale in case there is no activity on this for a bit

@rachitnigam rachitnigam changed the title Prevent Verilog keywords from being used as names Add Verilog reserved word: wait Oct 30, 2024
polybeandip added a commit that referenced this issue Oct 30, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants