Attribute Shorthand
Proposal Details
- Who Updates: DanielKho, <Add YourName >
- Date Proposed:
- Date Last Updated:
- Priority:
- Complexity:
- Focus:
Current Situation
Currently we need to declare every attribute before we use it to decorate an object. In many instances, an attribute is only applied to one object, instead of many objects. In these cases, it makes sense that we do not need to declare the attribute before we apply it to an object.
Requirement
Propose a shorthand to specify attributes.
Implementation details
For cases where an attribute can be applied to more than one object, the traditional way of specifying attributes may be used:
attribute period:time;
attribute period of clk0:signal is 10 ns;
attribute period of clk1:signal is 20 ns;
For cases where an attribute only needs to be applied for a single object, a shorthand may be used:
attribute period:time of clk:signal is 10 ns;
attribute maxTransition:time of clk:signal is 1.5 ns;
It would be an error if an attribute is redeclared as a different type:
attribute period:time of clk0:signal is 10 ns;
attribute period:integer of clk1:signal is 100; -- error, can't have a different
-- type for previously-declared attribute.
It would be an error if an attribute is redefined for a previously-defined object:
attribute period:time of clk:signal is 10 ns;
attribute period:time of clk:signal is 20 ns; -- error, conflicting attributes
If an attribute is redeclared to a different object, the declaration is ignored, but the previously-declared attribute adds a binding to the new object:
attribute period:time of clk0:signal is 10 ns;
attribute period:time of clk1:signal is 15 ns; -- declaration dropped, the "period" attribute
-- adds a new binding to "clk1".
Code Examples
Use Cases
Specifying physical constraints for layout (area, placement, routing), timing, and I/O.
/* Example Xilinx constraints. */
attribute loc:string;
attribute diff_term:boolean;
attribute iostandard:string;
attribute pullup:boolean;
attribute area_group:string;
attribute rloc_range:string;
/* I/O placement constraints and analogue buffer assignments. */
attribute loc of reset:signal is "h10"; -- pushbutton
attribute iostandard of reset:signal is "lvdci_25";
attribute loc of sysClkP:signal is "j9"; attribute diff_term of sysClkP:signal is true; attribute iostandard of sysClkP:signal is "lvds_25";
attribute loc of sysClkN:signal is "h9"; attribute diff_term of sysClkN:signal is true; attribute iostandard of sysClkN:signal is "lvds_25";
attribute loc of led:signal is "ad24 ae24 ag23 ab23 ae23 ae22 ac24 ac22"; attribute iostandard of led:signal is "lvcmos25";
Arguments FOR
Useful for backend / physical design, especially when specifying constraints on area, placement, timing, I/O, and any other physical design constraints directly from HDL.
Arguments AGAINST
General Comments
--
DavidKoontz - 2015-01-03
This strikes me as the opposite way around, you'd think you'd want to assign an attribute where the signal in your example is declared, noting that you can't use either object until they are declared.
--
DanielKho - 2015-01-04
Yes, the signal / variable that the attribute is applying to must have already been declared earlier. However, the attribute declaration and binding to an object is done in a single statement. Subsequent declarations of the same attribute will be ignored, but new bindings can be applied.
Supporters
Add your signature here to indicate your support for the proposal
attribute period:time; attribute period of clk:signal is 10 ns;
attribute maxTransition:time; attribute maxTransition of clk:signal is 1.5 ns;
--
DanielKho - 2015-01-02
--
PatrickLehmann - 2016-02-19