google / skywater-pdk

Open source process design kit for usage with SkyWater Technology Foundry's 130nm node.
https://skywater-pdk.rtfd.io
Apache License 2.0
2.99k stars 391 forks source link

VCS error due to defining default net type as none for primitives #425

Open M0stafaRady opened 1 year ago

M0stafaRady commented 1 year ago

Expected Behavior

VCS compile the library Verilog files

Actual Behavior

VCS throws errors like this for primitives

Identifier 'SET' has not been declared yet. If this error is not expected, 
  please check if you have set default_nettype to none. 

line 46

This error shows only with primitives. Compilation passed after commenting out the default_nettype none line before primitives.

Steps to Reproduce the Problem

  1. compile the primitives with VCS

Specifications

amm-efabless commented 5 months ago

Is it safe to comment out `default_nettype none and why does this help? I'm guessing it's a VCS quirk. I'm also not sure why SET is flagged but other ports/identifiers are not. SET seems to be declared as one would expect, but maybe this is a VCS bug or some other issue to do with SET often being a keyword in various implementations...?

M0stafaRady commented 5 months ago

It works because the default net type in verilog is wire. So if the default net type doesn't change any net with no definition would considered as a wire. The 2 code below would be equivalent:

    input  SET  ;
    input  wire SET  ;

but they are not in the case of default net type none

amm-efabless commented 5 months ago

Ah right, thanks @M0stafaRady! So I assume the reason it isn't flagged on the line above it (output Q) is because later Q is declared as a reg. Cool, thanks for the feedback.