Open mkurc-ant opened 5 years ago
@mithro I created this issue to keep track of attribute related features we want in Yosys. Those examples are just a subset of all possible attribute placement cases.
Anyway, can you give an real world example of usage of an attribute on a port connection ?
This is how I wanted to use the attribute on a port connection;
MUX2 rmux (
(* pack = "LUT5toLUT6; LUT5toLUT7; LUT5toLUT8" *)
.I0(n5lut_0_out),
(* pack = "LUT5x2" *)
.I1(n5lut_1_out),
.O(f6mux_O)
);
I started to work on attributes on port connections. And I encountered a problem - it seems that at some point Yosys swaps what RTLIL::SigSpec object refers to but not its attributes (which I added).
These examples are from Verilog — 2001 - A Guide to the New Features of the Verilog® Hardware Description Language Section 25. Attributes
,
always @(state) //state machine with one-hot encoding
(* full_case, parallel_case *) case (state)
3'b001: next_state = 3'b010;
3'b010: next_state = 3'b100;
3'b100: next_state = 3'b001;
endcase
The attribute is specified as a prefix to a declaration, a module item, a statement or a port connection. Three examples are:
(* optimize *) module control ( ... );
( state_variable ) reg [7:0] S;
dff il (q, d, ( clock_line ) ckl, rst};
> The attribute is specified as a suffix to an operator or the function name in a function call.
```verilog
sum = a + (* ripple_adder *) b;
assign next_state = fsm_func(* meally_fsm *) (state, a, b, c);
@mithro It's working: https://github.com/SymbiFlow/yosys/pull/30
Support for attributes on parameters was successfully landed (https://github.com/SymbiFlow/yosys/pull/25). However, there are several cases of attribute usage still not supported by the Yosys which might be useful in Symbiflow:
(not a complete list)
(* optimize *) module control ( ... );
(* port_attr *) input clk;
(* param_attr *) parameter WIDTH = 10;
(* localparam_attr *) localparam MAGIC = 8'hFE;
(* state_variable *) reg [7:0] S;
dff il (q, d, (* clock_line *) ckl, rst);
sum = a + (* ripple_adder *) b;
assign next_state = fsm_func(* meally_fsm *) (state, a, b, c);
(* inst_attr *) my_module my_instance (...);
(* gen_attr *) generate ...
(* spec_attr *) specify ...
(* specparam_attr *) specparam T = 10.0; ...