Forum Discussion

Kocsonya's avatar
Kocsonya
Icon for New Contributor rankNew Contributor
2 months 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.

 

 

3 Replies

  • Hi Kocsonya
     

    Could you please share the full Quartus warning/error message that is being reported?
     

    In the meantime, could you also try compiling the design with the latest Quartus version 26.1 and let us know whether the behavior is still reproducible?
     

    If the issue persists in Quartus 26.1, would it be possible to share a minimal reproducible test case?

    Thank you.

    Regards, 
    ZiYingE_Altera

  • Kocsonya's avatar
    Kocsonya
    Icon for New Contributor rankNew Contributor

    This particular problem does not exist, or more precisely, not in this form, in 26.1.

    I create a new thread which demonstrates the 26.1 bug, which is related to this one. That one has the exact test source and project file an everything to produce the bug.

    • ZiYingE_Altera's avatar
      ZiYingE_Altera
      Icon for Contributor rankContributor

      Hi Kocsonya,

       

      Thank you for the update. 
       

      Since the discussion is already being continued in the new thread, I will close this discussion for now.

      Thanks again for engaging with us! 

      Regards, 
      ZiYingE_Altera