hi!
Lets say I'm a newbie in AMS .. so there are maybe some points I miss or some missunderstandings, but give me a try:
I wrote a VPI function which should be able to handle real values only. Since I found out AMS-Designer doesn't allow to call system tasks/functions within the analog block I tried to get around with a trick -- it looks like that:
(module is maybe not compileable since i improvise - but it should be enough to give you an idea)
Code:module blabla (in, out)
input in; output out;
electrical in, out;
real vin;
real sig;
always @(cross(t,0)) begin
vin = V(in);
sig = $my_vpi_func(vin);
end
analog begin
@(initial_step) t = 1;
t = -t;
V(out) <+ sig;
end
endmodule
I'm quite sure this is the type of code which works.
The goal is clear: go only into the "always" block if spectre invokes a calculation
and it is also clear that ncsims time-resolution is responsible for the accuracy of the delay, but what is unclear is the resulting delay between the input and output signals, which is exactly the delay of one analog timestep (that is e.g. around 50-100 times the digital timestep).
The delay should be even visible if you skip the VPI function.
Again, maybe this is a complete wrong approach to solve such a "simple" problem, thus, I'm open for any suggestions.
thanks
armin