EmbDev.net

Forum: FPGA, VHDL & Verilog Unexpected Synthesized bit order in Quartus with SystemVerilog


Author: Joshua Vasquez (Company: Harvey Mudd College) (poofjunior)
Posted on:
Attached files:

Rate this post
0 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:
module test_mux( input logic [10:0] input_a,
                 input logic  override,
               output logic [10:0] output_c);

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

    assign output_c = (override) ?
                        constant :
                        input_a;
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:
parameter [10:0] constant = 11'h00F;
always_comb
begin
    integer i;
    for (i = 0; i < 11; i = i + 1)       
    begin
    output_c[i] = (override) ?
                       constant[i] :
                       input_a[i];
    end
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!

: Edited by User
Author: Lattice User (Guest)
Posted on:

Rate this post
0 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.)

Author: Joshua Vasquez (Company: Harvey Mudd College) (poofjunior)
Posted on:
Attached files:

Rate this post
0 useful
not useful
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.)

Author: Lattice User (Guest)
Posted on:

Rate this post
0 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

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.