keerthna
Member level 1
I wrote a piece of code for the incrementation of a variable at certain conditions but it is not happening the way it has to be. Can anyone please help me out with the same.
Here is my sample code
here the up value is not getting increment properly. is there something that i am missing out?
Here is my sample code
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 reg[31:0]nomfreq,nc1; reg [2:0] up,down; reg high; initial begin up=0 down=0; high=0 end always@(high) begin if(nc1>nomfreq) up<=up+1; if(up==2) begin newfreq<=nc1; nomfreq<=newfreq; end if((up==1)&&(down==1)) begin up=0; down=0 newfreq<=nomfreq; end
here the up value is not getting increment properly. is there something that i am missing out?
Last edited by a moderator: