bsaqycx
Junior Member
![* *](https://designers-guide.org/forum/Templates/Forum/default/starblue.gif)
Offline
Posts: 11
Asia
|
module led_fb_slicer(clk_out, clk_in, ibias_buf_n10u, ibias_n_2u, led_driver_off, vdd, vss); output clk_out; electrical clk_out; input clk_in; electrical clk_in; input ibias_buf_n10u; electrical ibias_buf_n10u; input ibias_n_2u; electrical ibias_n_2u; input led_driver_off; electrical led_driver_off; input vdd; electrical vdd; input vss; electrical vss; parameter real tr = 1e-10 from [0:inf); parameter real tf = 1e-10 from [0:inf); parameter real td = 2e-9 from [0:inf); real vh, vl, vth, state, last_time, current_time, freq, next; integer n, en, dis;
analog begin @(initial_step) begin next=$abstime; last_time = 0; freq = 0; n = 1; en=0; dis=1; vh = V(vdd); vl = V(vss); vth = 0.5*(vh+vl); end
@(cross(V(clk_in) - vth, 1, ,1e-12 ,dis)) begin current_time = $abstime; if (last_time > 0.0) freq = 1 / (current_time - last_time); last_time = current_time; end
if (freq>0)begin en=1; dis= 0; end
@(timer(next,,3e-10,en))begin n = !n; next = 0.5/freq +next; end state= (V(led_driver_off) < vth); V(clk_out) <+ transition ((state && n)? vl:vh,0,tr,tf);
end
endmodule
Now I use the "enable" function to control timer and cross, but sorry, there's still some parser errors.
Thx
|