Unexpected Synthesized bit order in Quartus with SystemVerilog

OP (Company: Harvey Mudd College) #4266345
Rate this post
useful
not useful
Hi everyone,

I was under the impression that the bit-order of values in SystemVerilog 
was left-to-right: MSbit-to-LSbit.

Recently, I wrote up a 11-bit-wide multiplexer:
1
module test_mux( input logic [10:0] input_a,
2
                 input logic  override,
3
               output logic [10:0] output_c);
4

5
parameter [10:0] constant = 11'h00F;                                            
6

7
    assign output_c = (override) ?
8
                        constant :
9
                        input_a;
10
endmodule

expecting the more-significant bits to be zeros and the last four 
less-significant bits to be ones. When I synthesized it and visualized 
the result, though, I got the unexpected constant 11'h780 as my constant 
input.

I tried an alternative:
1
parameter [10:0] constant = 11'h00F;
2
always_comb
3
begin
4
    integer i;
5
    for (i = 0; i < 11; i = i + 1)       
6
    begin
7
    output_c[i] = (override) ?
8
                       constant[i] :
9
                       input_a[i];
10
    end
11
end

and got the expected constant input to be 11'hf.

(a) Are the two above code snippets not the same??
(b) What is the expected bit-order in Quartus?

I'm ruling out that the RTL viewer is just rendering the values 
incorrectly. To do so, for the unexpected result, I expanded the mux 
input and saw that mux[0]: 1, mux[1]: 1 ... mux[10]:0, which would rule 
out that Quartus' RTL viewer is just rendering the result incorrectly.

Thanks for taking a look, and I'd appreciate any leads on this!

Cheers!
Guest #4266512
Rate this post
useful
not useful
It looks like a bug in Quartus, but this may be only in rendering the 
RTL view. Does Quartus also have a technology view?

(I have testet it with Synplify Pro (Lattice) and it worksn as 
expected.)
Guest #4267211
Rate this post
useful
not useful
There is an hint.
If you look closely, bits 0-3 are using the input DATAB on the logic 
cell, the others are using DATAD. So my guess it is a bug in the RTL 
View.

Wrong synthesis result would be a killer bug.

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now