| Anonymous | Login | 2010-09-08 03:28 PDT |
| Main | My View | View Issues | Docs | Wiki |
| Viewing Issue Simple Details [ Jump to Notes ] [ Wiki ] | [ View Advanced ] [ Issue History ] [ Print ] | |||||||||||
| ID | Category | Severity | Date Submitted | Last Update | ||||||||
| 0001273 | [SystemVerilog P1800] SV-BC | feature | 2006-01-04 22:27 | 2010-02-08 21:14 | ||||||||
| Reporter | shalom | View Status | public | |||||||||
| Assigned To | ||||||||||||
| Priority | normal | Resolution | open | |||||||||
| Status | new | Product Version | ||||||||||
| Summary | 0001273: Allowing parameters to define the length of a constant | |||||||||||
| Description |
This comes from B31 of the old enhancement request list for 1364-2001, by Adam Krolnik. The original request was as follows: Currently the only acceptable way to define the size of a constant is with a constant number, or a preprocessor substitution. Allowing parameters would at least bring numbers to the abilities of ports and other sized data types. Please consider allowing parameters (at the least) to define the length of a constant. Should there be other ways to specify the size of a value? Should there be a restriction that the size be constant? An Example module tst; `define length 4 `define width 6 parameter size = `len * `wid; reg[`width:1] a, out; reg[`length*`width:1] b; initial begin $display("Size is %0d.", size); b = size 'b0; // Using parameter to specify size. end always @(clk) begin {out, b} = {b, a}; end endmodule Proposed text: To section 2.5.1 "Integer constants" third paragraph, second sentence, which reads: "It [size constant] shall be specified as an unsigned decimal number." Replace it with: "It [size constant] shall be specified as an unsigned decimal number or a parameter." BNF: size ::= unsigned_number | parameter_identifier ----------------------------------------------------- SV has casting operation, but apparently does not have ability to cast to a parametric length. Discussion: Shalom: This would be useful. Steven: There could be order dependencies, since parameter values are only determined at elaboration time. Need restrictions. If we did this as a conversion function instead of as part of the syntax for specifying a constant, it would be better. Shalom: OK MEDIUM-HIGH priority. |
|||||||||||
| Additional Information |
Was BTF 594. I think there is an indirect way to do this in SV, by defining a type of the required length, and then casting to that type. But it would be nice if it were possible to cast directly to the required length. |
|||||||||||
| Tags | No tags attached. | |||||||||||
| Type | Clarification | |||||||||||
| Attached Files | ||||||||||||
|
|
||||||||||||
Relationships |
||||||
|
||||||
| Mantis 1.1.7[^] Copyright © 2000 - 2008 Mantis Group |