Quartus synthesis deletes bits of a variable that gets a constant value
Hi 🙂 I am running synthesis on a module that has to reg variables of [11:0] bits. These variables are getting constant values according to a switch case on two of the inputs. This is my code: ...
The input patterns requested all match to 4 possible cases – the MSB exactly, the LSB exactly, Or values E or 8
This seems to match exactly to the design being inferred by synthesis – what is being compared is ambiguous in the netlist viewer diagram, but it is using the MSB, LSB and these two 4-bit constants to accomplish the comparison.
Since every individual bit takes resources in an FPGA, it makes sense to minimize the functions like this to save resources.
//------------------------------------------------------- // Selectors MAP //------------------------------------------------------- // 00 - Send 0s on all pins // 01 - Send a series of '101010...' , first bit is '1' // 10 - Send a series of '010101...' , first bit is '0' // 11 - Send 1s on all pins //-------------------------------------------------------
always @(*) case ({selector_msb,selector_lsb}) 2'b00: begin Compare_data0 = 12'd0; Compare_data1 = 12'd0; end 2'b01: begin Compare_data0 = 12'hABC; Compare_data1 = 12'h789; end 2'b10: begin Compare_data0 = 12'b101010101010; Compare_data1 = 12'b101010101010; end 2'b11: begin Compare_data0 = 12'hFFF; Compare_data1 =12'hFFF; end endcase
That's just weird. I'd try deleting the compilation database files (db and incremental_db folders in Standard, qdb folder in Pro) and synthesize again.