Forum Discussion

Kocsonya's avatar
Kocsonya
Icon for New Member rankNew Member
8 hours ago

Possible Quartus 24.1 bug?

Here is the code:

interface myif
#(
parameter int W = 1
)();

typedef struct packed { logic [W-1:0] x; } MYSTRUCT;
MYSTRUCT s;
modport src ( output s );
modport dst ( input s );
endinterface

module top;
myif #( .w( 5 ) ) test_if();

test test_module
(
.foo( test_if )
);
endmodule

module test
(
myif.dst foo
);
typedef foo.MYSTRUCT MYSTRUCT_COPY;

$info( "%0d %0d", $bits( foo.MYSTRUCT ), $bits( MYSTRUCT_COPY ) );

MYSTRUCT_COPY q;
assign q = foo.s;
endmodule

Surprisingly, the info message will print "5 1" instead of "5 5". And for the assign Quartus will complain that it had to crop the 5 bit wide foo.s to match the 1 bit wide q.

When processing the typedef, Quartus uses the interface definition's default W value instead of the actual value of the actual interface port. I believe that, according to the standard, that is not the expected behaviour.

 

 

No RepliesBe the first to reply