-
Notifications
You must be signed in to change notification settings - Fork 146
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
Allow "pass-thru" synthesis annotations on ports and name bindings #445
Comments
Again, I appreciate you making suggestions! BSC supports a So I think there are two separate issues here. One is just increasing BSC's capability for passing attributes through from source to output, and two is adding new attribute behaviors. In your example, there is a pass-through attribute attached to a module port. Right now the Not everything in the source is preserved in the output (even if it had an obvious analog to begin with). With the Separately, I think it's a good idea to add a new attribute (or attributes) to directly support the kinds of things that people currently repurpose the For the
That is, the BSV parser would check that the first thing in quotes (the (At the moment, BSV is its own language and is mostly a skin on the underlying language, but originally the goal was for it to be an extension to SystemVerilog, and the current situation was just supposed to be a stepping stone towards that. So there used to be a lot of resistance to anything that wasn't SV syntax. But that ship has sailed, so we're probably more free to make changes to syntax. But we probably shouldn't diverge unnecessarily. I think in this case we could avoid inventing a bracket syntax.) Pass-through attributes could also be inserted into the output Verilog using Bluetcl or BSC features for correlating source names with output names. Such features could also be more generally useful. Sometimes you don't want an attribute in the output Verilog, but you have additional files that sit beside it (like a constraints file) and that file needs to references names/entities in the output Verilog, which may have names that don't exactly match their analog in the source. You may want BSC/Bluetcl to tell you the output names, knowing just the input names. |
FYI, I looked into this with @rsnikhil who may contribute some enhancements. As I mentioned, a first step would be to increase the places where the |
Nikhil pointed out that @jahagirdar also brought this up on the discussion mailing list last year: https://groups.io/g/b-lang-discuss/topic/80355042 In that thread, he mentioned some other scenarios to be mindful of: (1) attributes (like |
There are many use cases for attributes that are specified in the netlist; the most direct reasons are to guide the synthesis tool in some manner. Unfortunately, it's not possible to preserve or write arbitrary attributes in any way.
Two examples
There are two attributes I can think of off the top of my head.
(* keep *)
and(* preserve *)
In various cases you want the synthesis tool to not strip wires. My need for this is actually normally very pedestrian: I like to design things by writing empty modules and specifying the interfaces first, and I'd like to annotate the ports as
(* keep *)
so that I can properly see the block diagram layout in the synthesis tool is correct. (You can often justkeep
a bunch of things and incrementally remove them as you iterate and play with the design; it's normally how I make sure the synthesis tool is happy with particular constructs.)Things like
altera_attributes
Attributes like
altera_attribute
allow you to specify things like entity and instance properties such as pin assignments directly (see the example below,) and also guide other features. But pin assignment in a top level is something that would be nice.Prior art
This is mainly inspired by Clash, which has a type-level function called
Annotate
that lets you add attributes to things. For example:Maybe a hypothetical example
I have a pinout for the DE10-Pro and it would be nice if I could specify the clock pins and IO standards at the same time I write the port description. Here's a modified sample that might serve as a starting point:
The new syntax
annotate[x] = y
would add the attribute(* x = "y" *)
in the generated netlist. (Why introduce the brackets? Because it's significantly less ugly and requires significantly less quote-escaping than just using a raw string with cases likeattribute="x=\"...\"y\"...\""
)Alternatives
The pinout example has an obvious workaround, but in general you have to write a SystemVerilog module with the proper annotations, and then import it directly by writing a BVI import for it.
The text was updated successfully, but these errors were encountered: