Altera_Forum
Honored Contributor
15 years agoverilog code stuck
I want to use a toggle sw[13] to control the increment and decrement of threshold. Suppose that when the Sw[13]==1, pressing the pushbutton key[1] will increase the threshold value. And went the Sw[13]==0, pressing the pushbutton key[1] will decrease the threshold value. But, i now no matter the SW[13] in what state. The threshold is increased. Can anyone help me on this?
----------------------------------------------------------------------------- if(!iRST_N) begin iTHRESHOLD_0_TAD <= THRESHOLD_150 ; end else begin k1<=iAdjustThreshold_Adj; k2<=k1; if(iAdjustThreshold_0) begin if(!k1 && k2) begin //check whether the pushbutton is pressed iTHRESHOLD_0_TAD <= iTHRESHOLD_0_TAD+(1/5); end end else begin if(!k1 && k2) begin iTHRESHOLD_0_TAD <= iTHRESHOLD_0_TAD-(1/5); end end end end ---------------------------------------------------------------------