List of Messages |
function foo; input sel, a; begin if(sel) foo = a; end endfunctionThe following code also shows an example of a function that returns a Don't Care value. In this example, the Case Statement is incomplete because values of the Case Statement expression, which is the 2-bit reg variable sel, are not used in any of the case item expressions in the Case Statement. sel has a total of four possible binary values: 2'b00, 2'b01, 2'b10, and 2'b11 (Quartus Prime Integrated Synthesis considers only binary values when computing the input value set for a Case Expression). However, the case item expressions cover only three of the input values; no case item expression exists for sel == 2'b11. Therefore, the function foo does not assign a value to its output register when sel == 2'b11; instead, the function returns a Don't Care value.
function foo; input [1:0] sel; input a, b, c; begin case(sel) 2'b00: foo = a; 2'b01: foo = b; 2'b10: foo = c; -- Missing Case Item for sel == 2'b11 endcase end endfunction
ACTION: If you intended the function to return a Don't Care value for certain input values, no action is required. Otherwise, explicitly assign a value to the function's output register in every possible path through the function.
Copyright© 2015 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, HARDCOPY, MAX, MEGACORE, NIOS, QUARTUS, STRATIX, and all other brands, unless noted otherwise, and/or trademarks of Altera Corporation in the U.S. and other countries.