Unexpected Synthesized bit order in Quartus with SystemVerilog

OP (Company: Harvey Mudd College) #4266345
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
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.)
OP (Company: Harvey Mudd College) #4267146
Quartus does have a technology view, but from the looks of it I think 
the constant input is embedded in the logic cell without giving me any 
hints as to what value it's storing.

Thanks for the tip! I'll see if the folks at Altera have some more tips. 
(I'm using Quartus 15.0 right now.)
Attached files:
Guest #4267211
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

A question of your own? This thread is over 11 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.