ucsc-vama / essent

high-performance RTL simulator
Other
139 stars 13 forks source link

If there is a net with a name which happens to be a C++ keyword then this will cause a compiler error #1

Closed nijssen closed 3 years ago

nijssen commented 4 years ago

Example:

module Adder : 
    ...
    output io : {..., signed : UInt<1>, ...}

Will cause an output of:

UInt<1> signed;

To which the compiler complains:

error: declaration does not declare anything [-fpermissive]

This is because signed is a C++ keyword, in addition to being the name of that signal.

The behavior should be changed to not emit names that are reserved words in C++.

jleidel commented 4 years ago

Should be relatively simple to write a pass to sanitize signal names (https://en.cppreference.com/w/cpp/keyword).

sbeamer commented 4 years ago

Thanks for letting me know! As part of the near-term refactoring, I'll be adding a layer of indirection for the names used in the emitted C++. With that indirection, will be far easier to rename things, and I think this would be a great thing to use to sanitize those names.