billtsang
New Member
Offline
Posts: 1
|
Hi, I got syntax error when i " `include "constants.h" ". Can anyone point out the reason.
Error found by spectre during AHDL read-in. "th.def", line 10: "`<<--? include "constants.h"" "th.def", line 10: Error: syntax error "th.def", line 14: "electrical <<--? Pin, Nin, Pout, Nout ;" "th.def", line 14: Error: invalid module terminal type (*undef*) for Pout. "th.def", line 14: Error: invalid module terminal type (*undef*) for Nout. "th.def", line 14: Error: invalid module terminal type (*undef*) for Pin. "th.def", line 14: Error: invalid module terminal type (*undef*) for Nin. "th.def", line 14: Error: syntax error Maximum allowable errors exceeded. Exiting SpectreHDL compilation....
// Periodic Track & Hold // // Works with SpectreRF (has no hidden state) // Almost ideal ... // Has buffered input and output (infinite input Z, zero out Z) // Exhibits no offset or distortion errors // Only nonideality is finite aperture time and very small amount of droop
`include "constants.h" `include "disciplines.h"
module th (Pout, Nout, Pin, Nin) (period, delay, aperture, tc) electrical Pin, Nin, Pout, Nout ; input Pin, Nin; output Pout, Nout; parameter real period=16n from (0:inf); parameter real delay=0 from (0:inf); parameter real aperture=period/2 from (0:period/2); parameter real tc=aperture/10 from (0:aperture);
integer n; real tstart, tstop; electrical hold;
analog begin
// Determine the point where the aperture begins; n = ($abstime - delay + aperture) / period + 0.5; tstart = n*period + delay - aperture; @(timer(tstart));
// Determine the time where the aperture ends; n = ($abstime - delay) / period + 0.0; tstop = n*period + delay; @(timer(tstop));
// Implement switch with effective series resistence of 1 Ohm if (($abstime > tstop - aperture) && ($abstime <= tstop)) I(hold) <+ V(hold) - V(Pin, Nin); else I(hold) <+ 1.0e-12 * V(hold);
// Implement capacitor with an effective capacitance of tc I(hold) <+ tc * ddt(V(hold));
// Buffer output V(Pout, Nout) <+ V(hold);
// Control time step tightly during aperture and loosely otherwise if (($abstime >= tstop - aperture) && ($abstime < tstop)) begin $bound_step(tc); end else begin $bound_step(period/5); end
end endmodule
|