Open carlosedp opened 3 years ago
I have already started a draft implementation of this feature but the main problem where I'm stuck is how to place these directives inline with the declaration before the object's ;
.
I might need some help here.
I think you can take a look at AttributeAnnotation
implementation:
Basically, you need to extend from DescriptionAnnotation
. check the the all DescriptionAnnotation
usages in VerilogEmitter
:
Here are some places you can take a look:
https://github.com/chipsalliance/firrtl/blob/master/src/main/scala/firrtl/backends/verilog/VerilogEmitter.scala#L410
https://github.com/chipsalliance/firrtl/blob/master/src/main/scala/firrtl/backends/verilog/VerilogEmitter.scala#L526-L527
https://github.com/chipsalliance/firrtl/blob/94d1bee4c23bd3d8f99dae3ca431ffaa5dc1410d/src/main/scala/firrtl/backends/verilog/VerilogEmitter.scala#L960
You may need to add your implementation at:
https://github.com/chipsalliance/firrtl/blob/94d1bee4c23bd3d8f99dae3ca431ffaa5dc1410d/src/main/scala/firrtl/backends/verilog/VerilogEmitter.scala#L643 : reg / wire
https://github.com/chipsalliance/firrtl/blob/94d1bee4c23bd3d8f99dae3ca431ffaa5dc1410d/src/main/scala/firrtl/backends/verilog/VerilogEmitter.scala#L944-L957 : ports
I plan on looking into this again, I wonder what's the best approach and syntax to use this, Verilog-1995 or Verilog-2001.
As an example here: https://www.intel.com/content/www/us/en/support/programmable/articles/000074381.html:
Verilog-1995:
output reg my_reg /* synthesis syn_preserve = 1 */;
Verilog-2001
(* syn_preserve *) output reg my_reg;
Which is used by the Verilog emitter? While looking at [VerilogEmitterTests.scala], I saw that Verilog-2001 syntax is used in AttributeAnnotation. I wonder if it's the same thing.
Checklist
Feature Description
This feature request objective is to provide an annotation type to allow adding synthesis directives into the generated Verilog code for the synthesys tools.
The idea is that the annotation would allow generic, unfiltered text bound to a target. The targets could be
reg
,module
,input
,output
,case
,wire
and maybe others.Below some examples collected from synthesis manuals:
The content of this annotation is user's responsibility and in Firrtl we could add some validations like avoiding multiple
synthesys
words in case of multiple attributes.Firrtl annotation would be exposed similarly as below in Chisel code:
An easier interface could be added afterwards in Chisel.
Type of Feature