shirin_br wrote on Feb 2nd, 2007, 6:09am:The problem with timer is that I can not use any analog operation inside it.
You can't do a contrib, but you should be able to do a sample.
Code:module upsamp(in, out);
inout in, out;
electrical in, out;
parameter real T = 1u from (0:inf);
parameter integer L = 4 from [1:inf];
real vout;
integer count;
analog begin
@(initial_step or timer(0, T/L)) begin
if (count % L == 0)
vout = V(in);
else
vout = 0;
count = count + 1;
end
V(out) <+ transition(vout, 0, T/(L*10.0));
end
endmodule
I'm not sure if you want the transition there or not, or what the rise time should be. The timer should fire at the upsampling period (T/L) but only sample the input every Lth time, otherwise setting vout to zero.