Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16556 Discussions

Bug Report: Verilog ?: handling and sign extension

Altera_Forum
Honored Contributor II
1,253 Views

I have a couple of Quartus II Verilog standard compliance related bug reports of which this is the first one. If this is not the right place to report bugs: please point me in the right direction.. 

 

Consider the following test case: 

 

module issue_001(a, b, y); input a; input b; output y; // the ?: must evaluate to the max width of both cases, // even if we can be sure that always the smaller case gets selected assign y = &( 1 ? a : b ); endmodule  

 

The output of this module should be constant zero. Here is a short analysis of why this is so: 

 

Sec. 5.1.13 of the Verilog Standard (IEEE Std 1364-2005), which describes the ?: statement, states: 

[...] If the lengths of expression2 and expression3 are different, the shorter operand shall be 

lengthened to match the longer and zero-filled from the left (the high-order end). 

 

So with the condition beeing constant true, the expression in the parentheses must evaluate to {1'b0, a} and not simply a becasue of the size difference of a and b, thus the &-reduce operator should always see at least this one zero-bit and thus always return 0. 

 

But Quartus does not perform the zero filling and therefore produces an incorrect result, which is equivalent to assign y = &a;

 

In my tests I have synthesized the module with 

 

quartus_map issue_001 --source=issue_001.v --family="Cyclone III" quartus_fit issue_001 quartus_eda issue_001 --formal_verification --tool=conformal  

 

Crosscheck: Vivado 2013.4, Isim 14.7 and Modelsim 10.1d implement this correctly. Interestingly XST 14.7 suffers from the same bug. (It is the only bug in my list so far that can be found in two tools.) 

 

Note: This is a bug report. I don't need support.
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
335 Views

This is not the right place to report bugs, you need to file a support request. 

 

I'm not so familiar with Verilog syntax rules, but from a "how synthesis works" viewpoint, I understand why Quartus is apparently skipping the resize operation for a constant condition.
0 Kudos
Altera_Forum
Honored Contributor II
335 Views

 

--- Quote Start ---  

This is not the right place to report bugs, you need to file a support request. 

--- Quote End ---  

 

 

Thanks. I've now filed a "Service Request". I was at first scared away because it said it requires verified a "business" email address..
0 Kudos
Reply