Skip to content
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

Fix docs and add more testcases #3

Merged
merged 4 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,4 @@ under the Developer Certificate of Origin <https://developercertificate.org/>.
- Taichi Ishitani (@taichi-ishitani)
- Sosuke Hosokawa (@so298)
- Jan Remes (@remes-codasip)
- Ronit Nallagatla (@ronitnallagatla)
30 changes: 26 additions & 4 deletions MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5357,7 +5357,7 @@ logic [7:0][3:0] b;
endmodule
```

### Fail Example (1 of 2)
### Fail Example (1 of 4)
```systemverilog
module M;

Expand All @@ -5366,7 +5366,7 @@ logic a [7:0];
endmodule;
```

### Fail Example (2 of 2)
### Fail Example (2 of 4)
```systemverilog
module M;

Expand All @@ -5375,13 +5375,35 @@ logic [31:0] b [0:7];
endmodule;
```

### Fail Example (3 of 4)
```systemverilog
module M;

localparam bit [7:0] ARRAY [0:3];

endmodule
```

### Fail Example (4 of 4)
```systemverilog
module M (
input logic [7:0] a_in [0:5]
);

endmodule
```

### Explanation

This rule forbids unpacked array declarations.

Unpacked arrays are not guaranteed to be represented as contiguous memory, and can cause issues with synthesis tools, especially with how multidimensional arrays are synthesized. For example, a synthesis tool might synthesize out unused memory locations of an unpacked array which is not the intended behavior.
Unpacked arrays are not guaranteed to be represented as contiguous memory, and
can cause issues with synthesis tools, especially with how multidimensional
arrays are synthesized. For example, a synthesis tool might synthesize out
unused memory locations of an unpacked array which is not the intended behavior.

Additionally, packed arrays allow the user to intuitively index and slice the array and apply bitwise operations.
Additionally, packed arrays allow the user to intuitively index and slice the
array and apply bitwise operations.

The most relevant clauses of IEEE1800-2017 are:
- 7.4 Packed and unpacked arrays
Expand Down
8 changes: 6 additions & 2 deletions md/syntaxrules-explanation-unpacked_array.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
This rule forbids unpacked array declarations.

Unpacked arrays are not guaranteed to be represented as contiguous memory, and can cause issues with synthesis tools, especially with how multidimensional arrays are synthesized. For example, a synthesis tool might synthesize out unused memory locations of an unpacked array which is not the intended behavior.
Unpacked arrays are not guaranteed to be represented as contiguous memory, and
can cause issues with synthesis tools, especially with how multidimensional
arrays are synthesized. For example, a synthesis tool might synthesize out
unused memory locations of an unpacked array which is not the intended behavior.

Additionally, packed arrays allow the user to intuitively index and slice the array and apply bitwise operations.
Additionally, packed arrays allow the user to intuitively index and slice the
array and apply bitwise operations.

The most relevant clauses of IEEE1800-2017 are:
- 7.4 Packed and unpacked arrays
12 changes: 12 additions & 0 deletions testcases/syntaxrules/fail/unpacked_array.sv
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,15 @@ module M;
logic [31:0] b [0:7];

endmodule;
////////////////////////////////////////////////////////////////////////////////
module M;

localparam bit [7:0] ARRAY [0:3];

endmodule
////////////////////////////////////////////////////////////////////////////////
module M (
input logic [7:0] a_in [0:5]
);

endmodule