The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Modeling >> Behavioral Models >> problem with detecting falling edge https://designers-guide.org/forum/YaBB.pl?num=1279807232 Message started by mowiehowie on Jul 22nd, 2010, 7:00am |
Title: problem with detecting falling edge Post by mowiehowie on Jul 22nd, 2010, 7:00am hi all. i need to detect a falling edge in order to count it and generate a signal. i've made a code like this: analog begin @(initial_step) begin cycle = 0; carrega = 0; k = 0; serial = 0; vth = 0.9*V(dvdd,dgnd); end @(cross(V(clk)-vth, 1)) begin if (cycle < 71) cycle = cycle + 1; $strobe(cycle); if (cycle <= 70) serial = $table_model(cycle, "testvector.dat", "D"); if (cycle == 71) cycle = 0; end @(cross(V(clk)-vth, -1)) begin if (k < 71) k = k + 1; $strobe(k); if (k == 71) carrega = 1; k = 0; end V(out_d,dgnd) <+ serial*V(dvdd,dgnd); V(load,dgnd) <+ carrega*V(dvdd,dgnd); end endmodule in fact, i can see that the rising edge is detected properly but the falling edge is not. k only reaches '1'. it doesnt increase anymore. what might be going on? |
Title: Re: problem with detecting falling edge Post by Geoffrey_Coram on Jul 22nd, 2010, 12:12pm A stupid trick for checking this might be to change @(cross(V(clk)-vth, -1)) begin to this: @(cross(vth-V(clk), 1)) begin |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |