Schematic Capture (ModelSim)
Once the foreign model or models are created in Twin Builder, they can be used like any other Twin Builder model. Drop them on the sheet and connect them to other Twin Builder models to create the schematic. The following figure shows the schematic for a simple ring oscillator model created using two instances (inv_modelsim1 and inv_modelsim2) of the inverter model described above.
The AToD VHDL-AMS model is described below.
ENTITY AToD IS
GENERIC (TS : REAL := 0.0);
PORT (QUANTITY INPUT : IN REAL := 0.0;
QUANTITY THRES1 : IN REAL := 0.01;
QUANTITY THRES2 : IN REAL := 0.99;
SIGNAL sig : OUT BIT := '0');
END ENTITY AToD;
ARCHITECTURE behav OF AToD IS
SIGNAL upper_crossing : BOOLEAN := FALSE;
SIGNAL lower_crossing : BOOLEAN := TRUE;
BEGIN
upper_crossing <= input'ABOVE(THRES2);
lower_crossing <= NOT input'ABOVE(THRES1);
BREAK ON upper_crossing, lower_crossing;
PROCESS (upper_crossing,lower_crossing)
BEGIN
IF (INPUT<THRES1) THEN
sig <= '0';
ELSIF (INPUT > THRES2) THEN
sig <= '1';
END IF;
END PROCESS;
END ARCHITECTURE;