mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 00:55:32 +00:00
Support for swapped ranges in second array dimension
This commit is contained in:
parent
bab88630c2
commit
ddb12148e7
2 changed files with 52 additions and 3 deletions
|
@ -59,6 +59,27 @@ module top;
|
|||
|
||||
always_comb assert(s3==80'hFC00_4200_0012_3400_FFFC);
|
||||
|
||||
// Same as s3, but with little endian bit addressing
|
||||
struct packed {
|
||||
bit [0:7] [0:7] a; // 8 element packed array of bytes
|
||||
bit [0:15] b; // filler for non-zero offset
|
||||
} s3_b;
|
||||
|
||||
initial begin
|
||||
s3_b = '0;
|
||||
|
||||
s3_b.a[5:6] = 16'h1234;
|
||||
s3_b.a[2] = 8'h42;
|
||||
|
||||
s3_b.a[0] = '1;
|
||||
s3_b.a[0][6:7] = '0;
|
||||
|
||||
s3_b.b = '1;
|
||||
s3_b.b[14:15] = '0;
|
||||
end
|
||||
|
||||
always_comb assert(s3_b==80'hFC00_4200_0012_3400_FFFC);
|
||||
|
||||
// Note that the tests below for unpacked arrays in structs rely on the
|
||||
// fact that they are actually packed in Yosys.
|
||||
|
||||
|
@ -104,6 +125,27 @@ module top;
|
|||
|
||||
always_comb assert(s5==80'hFC00_4200_0012_3400_FFFC);
|
||||
|
||||
// Same as s5, but with little endian bit addressing
|
||||
struct packed {
|
||||
bit [0:7] a [0:7]; // 8 element unpacked array of bytes
|
||||
bit [0:15] b; // filler for non-zero offset
|
||||
} s5_b;
|
||||
|
||||
initial begin
|
||||
s5_b = '0;
|
||||
|
||||
s5_b.a[5:6] = 16'h1234;
|
||||
s5_b.a[2] = 8'h42;
|
||||
|
||||
s5_b.a[0] = '1;
|
||||
s5_b.a[0][6:7] = '0;
|
||||
|
||||
s5_b.b = '1;
|
||||
s5_b.b[14:15] = '0;
|
||||
end
|
||||
|
||||
always_comb assert(s5_b==80'hFC00_4200_0012_3400_FFFC);
|
||||
|
||||
// Same as s5, but using C-type unpacked array syntax
|
||||
struct packed {
|
||||
bit [7:0] a [8]; // 8 element unpacked array of bytes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue