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

[RFC] Use extended/escaped identifiers naming attribute references? #61

Open
jck opened this issue Apr 11, 2015 · 9 comments
Open

[RFC] Use extended/escaped identifiers naming attribute references? #61

jck opened this issue Apr 11, 2015 · 9 comments

Comments

@jck
Copy link
Member

jck commented Apr 11, 2015

We're currently replacing periods with underscores and performing rudimentary collision detection. However, I don't think this technique is very robust and wont scale well when we start to support crazier things (like dicts).

I think we should use escaped identifiers for verilog[1] and extended identifiers for VHDL[2] to simplify the conversion logic.

It would also prevent bugs like #33 in the future.

[1] http://verilog.renerta.com/source/vrg00018.htm
[2] http://www.seas.upenn.edu/~ese171/vhdl/vhdl_primer.html#_Toc526061347

@jandecaluwe
Copy link
Contributor

I understand, but are we sure all our target backend tools support this?

@jmgc
Copy link
Contributor

jmgc commented Apr 11, 2015

Dear all,

Why not use records in VHDL and structs in Verilog? For the first, all the VHDL93 should be able to work with them, in case of Verilog I am not an expert. But probably, different solutions can be used depending on the language/simulator.

Best,

Jose M.

El 11/04/2015, a las 17:06, jandecaluwe notifications@github.com escribió:

I understand, but are we sure all our target backend tools support this?


Reply to this email directly or view it on GitHub.

@jandecaluwe
Copy link
Contributor

VHDL records are too limited, plain Verilog does not have structs.

@jmgc
Copy link
Contributor

jmgc commented Apr 12, 2015

Sorry, but why do you say that records are too limited. I have used them, and their behaviour is like structs in C. Which is the functionality you miss?

Thanks,

Jose M.

El 11/04/2015, a las 21:19, jandecaluwe notifications@github.com escribió:

VHDL records are too limited, plain Verilog does not have structs.


Reply to this email directly or view it on GitHub.

@jck
Copy link
Member Author

jck commented Apr 14, 2015

Quartus, Modelsim and Synopsys tools support this.

Based on what I can find online [1,2], Xilinx and Cadence tools also support this.

[1] http://www.xilinx.com/support/answers/1535.html
[2] https://lost-contact.mit.edu/afs/ict.kth.se/pkg/cadence/ic610/06.14.506/doc/compvhdluser/glossary.html

@cfelton
Copy link
Member

cfelton commented Apr 14, 2015

@jck, is the idea to simply add the "extended identifier" escapes at the end, a post-processing transformation?

Is so, what is the risk if post-processing "name transformation" (i.e. replace unsupported characters) was done instead of inserting the escape \? There are other "name transformations" that could be useful: keyword collisions, unsupported characters (VHDL and leading underscore), expanded names, etc.

My initial reaction was the same as Jan', concerned about interoperability. Mainly due to my inexperience with extended identifier. I did some quick tests with Icarus and GHDL and they both seem to support extended identifiers as well.

With the extended identifier, name expansion will look like this?

myobj.x.next = yourobj.y + silly.samsobj.z
\myobj.x = \yourobj.y + \silly.samsobj.z ;
\myobj.x\ = \yourobj.y\ + \silly.samsobj.z\ ;

@jck
Copy link
Member Author

jck commented Apr 14, 2015

Yes, each conversion module would have a write_name function which would take care of avoiding invalid names. That function can apply all the checks required for the target HDL.

@jck
Copy link
Member Author

jck commented Apr 14, 2015

I think we should still prefer underscores for top level ports. One reason is that qsys uses underscores in the naming scheme for automatically detecting interfaces.

@cfelton
Copy link
Member

cfelton commented Nov 11, 2015

@nturley has created MEP113 that expands on the ideas proposed in this issue.

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

No branches or pull requests

4 participants