moreed
New Member
Offline
Posts: 1
|
i have to implement a counter in verilog-A that counts the number of beats of a signal(beat frequency counter). for example, the input pulse is varying (5u s, 12u s , 14u s) and the reference signal is 1u s. i want the counter to to give (5 , 12 , 14). in decimal or in analog format.
The verilog-A im writing is as follows: module counter_a(vout, vclk, vin);
input vclk, vin; electrical vout, vclk, vin; parameter real vlogic_high = 1.0; parameter real vlogic_low = 0; parameter real vtrans_clk = 0.6; parameter real vtrans = 0.6; parameter real tdel = 50p from [0:inf); parameter real trise = 20p from (0:inf); parameter real tfall = 20p from (0:inf);
real x;
analog begin @ (cross( V(vin) - vtrans_clk, +1 )) begin V(x) = ( V(vin) * V(vclk));
end
V(vout) <+ transition ( V(x) * vlogic_high, tdel, trise, tfall);
end // $strobe ("Count is %d", x);
endmodule
please any help
|