18 for(clk_cycle=1; (clk_cycle<sp->
clk_cycles_nr-1) && (pp_next!=NULL); clk_cycle++)
39 int index,
PHASE phase,
int sig_nr)
44 checkpoint->
index = index;
46 if(phase/M_PI - checkpoint->
pi_phase > 0.5)
50 checkpoint->
next=NULL;
59 int clk_cycle, sig_num, out_nr;
63 int initial_phase_set;
71 for(out_nr=0; out_nr<sp->
outs_num; out_nr ++)
77 pp = pp_next = sp->
sig_bgn[sig_num];
95 initial_phase_set = 0;
101 initial_phase_set = 1;
111 printf(
"Warning!\n");
112 printf(
"First pulse at the output %s is too close to the point where\n",
114 printf(
"the simulation is started to be traced.\n");
115 printf(
"The phase before this pulse will not be checked.\n");
116 printf(
"position of the pulse = %.2f ps\n\n", pp->
t*1.0e12);
126 if(!initial_phase_set)
134 if(initial_phase_set)
145 if(initial_phase_set)
150 initial_phase_set = 1;
154 printf(
"Warning!\n");
155 printf(
"Consecutive output pulses at the output %s\n",
157 printf(
" are too close to define the checkpoints between them.\n");
158 printf(
"position of pulse 1 = %.2f ps\n", pp->
t*1.0e12);
159 printf(
"position of pulse 2 = %.2f ps\n\n", pp_next->
t*1.0e12);
165 if(!initial_phase_set)
167 printf(
"Warning!!!\n");
168 printf(
"None checkpoint could be set at output %s !!!\n\n",
176 if(check1 < sp->indices_nr)
185 printf(
"Warning!\n");
186 printf(
"Last pulse at the output %s is too close to the point where\n",
188 printf(
"the simulation is finished to be traced.\n");
189 printf(
"The phase after this pulse will not be checked.\n");
190 printf(
"position of the pulse = %.2f ps\n\n", pp->
t*1.0e12);
209 if(last_checkpoint!=NULL)
211 checkpoint->
next = last_checkpoint->
next;
212 last_checkpoint->
next = checkpoint;
226 ASYNC_CHECK *first_checkpoint=NULL, *tmp_checkpoint=NULL;
229 int minimum_index, minimum_out_nr;
240 for(out_nr=0; out_nr<sp->
outs_num; out_nr++)
247 for(out_nr=0; out_nr<sp->outs_num; out_nr++)
249 if(lastcheckpts[out_nr]!=NULL)
251 if(lastcheckpts[out_nr]->index < minimum_index)
253 minimum_index = lastcheckpts[out_nr]->
index;
254 minimum_out_nr = out_nr;
263 tmp_checkpoint=
add_to_the_list(sp, tmp_checkpoint, lastcheckpts[minimum_out_nr]);
267 if(first_checkpoint==NULL)
268 first_checkpoint = tmp_checkpoint;
269 lastcheckpts[minimum_out_nr]=lastcheckpts[minimum_out_nr]->
next;
273 sp->async_check_list = first_checkpoint;
283 if(tmp_checkpoint == NULL)
295 while(tmp_checkpoint->
next!=NULL)
302 tmp_checkpoint = tmp_checkpoint->
next;
313 int clk_cycle, sig_num, out_num;
323 fprintf(fp,
"%d", sp->
sig_log[sig_num][clk_cycle].
val);
329 if(runall) fprintf(fp,
"run\n");
331 acc_phase = (
int*) calloc(sp->
outs_num,
sizeof(
int));
339 if(!runall) fprintf(fp,
"step %d\n",
345 fprintf(fp,
"if chFAIL = 0\n");
346 if(!runall) fprintf(fp,
"\tstep %d\n",
354 acc_phase[out_num]+=2;
356 fprintf(fp,
"\tif abs(%s[%d] - %s[%d] - %d*pi) > failthres\n",
362 fprintf(fp,
"\t\tchFAIL = 1\n");
363 fprintf(fp,
"\t\techo FAILED FOR TIME = %.1f\n",
366 fprintf(fp,
"\tend\n");
370 fprintf(fp,
"end\n\n");
380 int clk_cycle, sig_num;
383 for(clk_cycle=1; clk_cycle<sp->
clk_cycles_nr-1; clk_cycle++) {
384 fprintf(fp,
"\tif abs(%s[%d] - %s[%d] - %d*pi) > failthres\n",
391 fprintf(fp,
"\t\tchFAIL = 1\n");
392 fprintf(fp,
"\tend\n");
410 fprintf(fp,
"* checkpoints:");
412 while(tmp_check!=NULL)
416 fprintf(fp,
"%6.1f ",
419 while(tmp_check->
next!=NULL)
422 tmp_check=tmp_check->
next;
426 tmp_check=tmp_check->
next;
430 if(runall) fprintf(fp,
"run\n");
435 while(tmp_check!=NULL)
439 fprintf(fp,
"if chFAIL = 0\n");
440 if(!runall) fprintf(fp,
"\tstep %d\n", tmp_check->
index-last_index);
447 sig_num = tmp_check->
sig_nr;
448 fprintf(fp,
"\tif abs(%s[%d] - %s[%d] - %d*pi) > failthres\n",
454 fprintf(fp,
"\t\tchFAIL = 1\n");
455 fprintf(fp,
"\t\techo FAILED FOR TIME = %.1f\n", sp->
start_time*1.0e12 +
457 fprintf(fp,
"\tend\n");
459 while(tmp_check->
next!=NULL)
463 tmp_check=tmp_check->
next;
464 sig_num = tmp_check->
sig_nr;
465 fprintf(fp,
"\tif abs(%s[%d] - %s[%d] - %d*pi) > failthres\n",
471 fprintf(fp,
"\t\tchFAIL = 1\n");
472 fprintf(fp,
"\t\techo FAILED FOR TIME = %.1f\n", sp->
start_time*1.0e12 +
474 fprintf(fp,
"\tend\n");
481 fprintf(fp,
"end\n\n");
488 last_index = tmp_check->
index;
489 tmp_check=tmp_check->
next;
498 int *last_index,
int runall)
501 PULSE *pp, *pp_prev, *pp_last;
502 int pulses_nr=0, check_index;
503 int initial_phase_set=0;
504 int check_index_set=0;
521 printf(
"Simulation period too short to check for back travelling pulses\n");
531 if(!initial_phase_set)
542 printf(
"Warning!\n");
543 printf(
"First pulse at the input %s is too close to the point where\n",
545 printf(
"the simulation is started to be traced.\n");
546 printf(
"The phase before this pulse will not be checked.\n");
547 printf(
"position of the pulse = %.2f ps\n\n", pp->
t*1.0e12);
560 printf(
"Warning!\n");
561 printf(
"Consecutive pulses at the input %s\n",
563 printf(
" are too set the checkpoint between them.\n");
564 printf(
"position of pulse 1 = %.2f ps\n", pp->
prev->
t*1.0e12);
565 printf(
"position of pulse 2 = %.2f ps\n\n", pp->
t*1.0e12);
613 if(check_index > sp->initial_phase_index[sig_nr])
615 if(check_index > *last_index)
617 if(!runall) fprintf(fp,
"\tstep %d\n", check_index - *last_index);
618 *last_index = check_index;
620 fprintf(fp,
"\tif abs(%s[%d] - %s[%d] - %d*pi) > failthres\n",
621 sp->jspice_phase_names[sig_nr],
623 sp->jspice_phase_names[sig_nr],
624 sp->initial_phase_index[sig_nr],
626 fprintf(fp,
"\t\tchFAIL = 1\n");
627 fprintf(fp,
"\tend\n\n");
631 check.index = check_index;
632 check.pi_phase = 2*pulses_nr;
637 printf(
"Warning!!!\n");
638 printf(
"Test for back travelling pulses on input %s cannot be performed because the pulses are too close to each other.\n\n", sp->signal_names[sig_nr]);
654 fp=fopen(filename,
"w");
658 fprintf(fp,
"%s\n", filename);
659 fprintf(fp,
".control\n\n");
668 fprintf(fp,
"\nif chFAIL = 0\n");
669 fprintf(fp,
"if check_inputs = 1\n");
684 fprintf(fp,
"\tif chFAIL = 1\n");
685 fprintf(fp,
"\t\techo FAILED BECAUSE OF EXTRA INPUT PULSES\n");
686 fprintf(fp,
"\tend\n");
687 fprintf(fp,
"end\n");
688 fprintf(fp,
"end\n\n");
690 fprintf(fp,
"if chFAIL = 1\n");
691 fprintf(fp,
"\tfree all yes\n");
692 fprintf(fp,
"\tchFAIL = 1\n");
693 fprintf(fp,
"end\n\n");
695 fprintf(fp,
"if chFAIL = 0\n");
696 fprintf(fp,
"\tfree all yes\n");
697 fprintf(fp,
"\tchFAIL = 0\n");
698 fprintf(fp,
"end\n\n");
707 int sig_num, last_sig;
752 int clk_cycle, sig_num, out_num, check_nr;
756 acc_phase = (
int*) calloc(sp->
outs_num,
sizeof(
int));
765 acc_phase[out_num]+=2;
770 check.
pi_phase = acc_phase[out_num];
782 int sig_num, out_num, check_nr;
785 fp=fopen(filename,
"w");
794 fprintf(fp,
".check\n\n");
798 fprintf(fp,
"checkVAL%d = \n", i);
799 fprintf(fp,
"checkSTP%d = \n", i);
800 fprintf(fp,
"checkDEL%d = \n\n", i);
803 fprintf(fp,
"compose checkPNTS values ");
807 while(tmp_check!=NULL)
809 fprintf(fp,
"%6.1fps ",
812 while(tmp_check->
next!=NULL)
815 tmp_check=tmp_check->
next;
819 tmp_check=tmp_check->
next;
821 fprintf(fp,
"%6.1fps\n\n",
826 fprintf(fp,
"checkFAIL = 0\n");
834 fprintf(fp,
".control\n\n");
839 while(tmp_check!=NULL)
841 fprintf(fp,
"if TIME > checkPNTS[%d]\n", check_nr);
842 fprintf(fp,
"\tif TIME < checkPNTS[%d]\n", check_nr+1);
844 sig_num = tmp_check->
sig_nr;
847 fprintf(fp,
"\t\tif abs(%s - phase0[%d] - %d*pi) > failthres\n",
851 fprintf(fp,
"\t\t\tcheckFAIL = 1\n");
852 fprintf(fp,
"\t\tend\n");
856 fprintf(fp,
"\t\tphase0[%d] = %s\n",
861 while(tmp_check->
next!=NULL)
865 tmp_check=tmp_check->
next;
866 sig_num = tmp_check->
sig_nr;
869 fprintf(fp,
"\t\tif abs(%s - phase0[%d] - %d*pi) > failthres\n",
873 fprintf(fp,
"\t\t\tcheckFAIL = 1\n");
874 fprintf(fp,
"\t\tend\n");
879 fprintf(fp,
"\t\tphase0[%d] = %s\n",
888 fprintf(fp,
"\tend\n");
889 fprintf(fp,
"end\n\n");
891 tmp_check=tmp_check->
next;
896 fprintf(fp,
".endc\n");
902 fprintf(fp,
".end\n");
static ASYNC_CHECK * add_to_the_list(SIGNALS *sp, ASYNC_CHECK *last_checkpoint, ASYNC_CHECK *check)
struct async_checkpoint * next
static int add_clk_checkpoints(FILE *fp, SIGNALS *sp)
#define REGULAR_CHECKPOINT
char circuit_name[NAME_LENGTH]
ASYNC_CHECK ** async_check_index
static int add_input_checkpoint(FILE *fp, SIGNALS *sp, int sig_nr, int *last_index, int runall)
static void make_list_of_async_checks(SIGNALS *sp)
static int generate_sync_passfail(SIGNALS *sp, FILE *fp, int runall)
char(* jspice_phase_names)[NAME_LENGTH]
int * initial_phase_index
char param_ext[NAME_LENGTH]
static void add_sync_checkpoints(SIGNALS *sp)
char(* signal_names)[NAME_LENGTH]
static int generate_async_passfail(SIGNALS *sp, FILE *fp, int runall)
static int add_to_the_list_of_async_checks(SIGNALS *sp, ASYNC_CHECK *check)
static void compute_sync_check_indices(SIGNALS *sp)
char input_dir[NAME_LENGTH]
int generate_check_file(SIGNALS *sp, char *filename)
char check_ext[NAME_LENGTH]
char circuit_ext[NAME_LENGTH]
ASYNC_CHECK * async_check_list
static void add_initial_checkpoints(SIGNALS *sp)
int generate_passfail_file(SIGNALS *sp, char *filename, int runall)
static char filename[LINE_LENGTH]
static ASYNC_CHECK * add_async_checkpoint(ASYNC_CHECK *last_checkpoint, int index, PHASE phase, int sig_nr)
static void compute_async_check_indices(SIGNALS *sp)