Initial version of donated sources by Avertec, 3.4p5.
[tas-yagle.git] / distrib / sources / behvhdl / vhd_drive.c
1 /****************************************************************************/
2 /* */
3 /* file : vhd_drive.c */
4 /* date : Oct 1999 */
5 /* version : v202 */
6 /* author(s): LESTER A.P.P */
7 /* : PINTO A. */
8 /* description : Synopsys VHDL driver */
9 /* */
10 /****************************************************************************/
11
12 #include <stdlib.h>
13 #include <stdio.h>
14 #include <string.h>
15 #include <time.h>
16 #include <stdarg.h>
17 #include <math.h>
18
19 #include AVT_H
20 #include MUT_H
21 #include LOG_H
22 #include BEH_H
23 #include BEG_H
24 #include BEF_H
25 #include BHL_H
26 #include BVL_H
27 #include "bvl_utype.h"
28 #include "bvl_utdef.h"
29 #include "bvl_util.h"
30
31 /* Global variables */
32
33 static char *TIME_UNIT;
34
35 static int BVL_VECT_ASS = 0;
36 static int BVL_LOOP_IND[] = {0,0,0,0,0,0,0,0,0,0,
37 0,0,0,0,0,0,0,0,0,0,
38 0,0,0,0,0,0,0,0,0,0};
39 static int BVL_CPT_IND = 0;
40
41 /****************************************************************************/
42 /*{{{ Static function prototypes */
43 /****************************************************************************/
44 static void writelist (FILE *fp, chain_list *ptchain, int indent);
45 static void begen_treatment (FILE *fp, befig_list *figure);
46
47 static void print_msg(FILE *fp, befig_list *figure, char **buffer, int *bufsize);
48 //static void print_value(FILE *fp,chain_list *abl, int time, char **buffer, int *bufsize);
49 static void print_withselect(FILE *fp, biabl_list *biabl, char *name, int vectsize, char **buffer, int *bufsize);
50 static void print_time (FILE *fp, int time,int,int);
51 static char *vhd_bebusname (char *name);
52 //static void print_withselect (FILE *fp, biabl_list *biabl, char *name, int vectsize);
53 //static void print_value (FILE *fp, chain_list *abl, int time);
54
55 //static void print_affected (FILE *fp, char indent,char *name,char *vname,loop_list *loop);
56 static void print_loop (FILE *fp, char indent,char *head,int np,int *cpt,loop_list *loop);
57 static void print_endLoop (FILE *fp,char indent,char *head,int np,int cpt, int nbsame,loop_list *loop);
58 static void print_loopList (FILE *fp,char indent,char *head,int np,int *cpt, int nbsame,loop_list *loop);
59 static void print_interassign (FILE *fp, char *dest, char *src, int mode);
60 //static void print_signal (FILE *fp, char *name, int left, int right);
61
62 static chain_list *print_process_declaration(FILE *fp, biabl_list *biabl, char *name, int np, char *head, char **buffer,ptype_list*clock);
63
64 /*}}}************************************************************************/
65 /*{{{ Utilities */
66 /****************************************************************************/
67 /*{{{ settimeunit() */
68 /* */
69 /* */
70 /****************************************************************************/
71 void settimeunit (unsigned char time_unit_char)
72 {
73 TIME_UNIT = bef_gettimeunit(time_unit_char);
74 }
75
76 /*}}}************************************************************************/
77 /*{{{ writelist() */
78 /* */
79 /* ecrit dans un fichier une chaine list */
80 /****************************************************************************/
81 static void writelist(FILE *fp, chain_list *ptchain, int indent)
82 {
83 char *name;
84 char indentstr[80];
85 int hpos;
86 int first = TRUE;
87 int i;
88 chain_list *namelist = NULL;
89 chain_list *chainx;
90 chain_list *tail;
91
92 hpos = indent;
93 for (i=0; i<indent; i++)
94 indentstr[i] = ' ';
95 indentstr[i] = '\0';
96
97 // pre-traitement de la liste pour supprimmer les doublons
98 for (; ptchain; ptchain = ptchain->NEXT)
99 {
100 if ( isBitStr(ptchain->DATA) )
101 continue;
102 beg_get_vectname(ptchain->DATA,&name,NULL,NULL,BEG_SEARCH_ABL);
103 tail = NULL;
104 for (chainx=namelist;chainx;chainx=chainx->NEXT)
105 {
106 tail = chainx;
107 if (name == chainx->DATA)
108 break;
109 }
110 if (!chainx)
111 if (tail)
112 tail->NEXT = addchain(NULL,name);
113 else
114 namelist = addchain(NULL,name);
115 else
116 continue;
117 }
118
119 for (chainx = namelist; chainx; chainx = chainx->NEXT)
120 {
121 if (!first)
122 fprintf(fp, ", ");
123 if (hpos > 60)
124 {
125 fprintf(fp, "\n%s", indentstr);
126 hpos = indent;
127 }
128 name = chainx->DATA;
129 hpos += strlen(name) + 2;
130 fprintf(fp,"%s",bvl_vhdlname(name));
131 first = FALSE;
132 }
133 freechain(namelist);
134 }
135
136 /*}}}************************************************************************/
137 /*{{{ print_time() */
138 /* */
139 /* */
140 /****************************************************************************/
141 void print_time(FILE *fp,int time,int timer, int timef)
142 {
143 if (time)
144 fprintf(fp," AFTER %u %s",time,TIME_UNIT);
145 }
146
147 /*}}}************************************************************************/
148 /*{{{ isone() */
149 /* */
150 /* */
151 /****************************************************************************/
152 static int isone(char *txt)
153 {
154 return !strcmp(txt,"'1'");
155 }
156
157 /*}}}************************************************************************/
158 /*{{{ vhd_bebusname() */
159 /* */
160 /* */
161 /****************************************************************************/
162 static char *vhd_bebusname(char *name)
163 {
164 return name;
165 }
166
167 /*}}}************************************************************************/
168 /*{{{ vhd_beregname() */
169 /* */
170 /* */
171 /****************************************************************************/
172 static char *vhd_beregname(char *name)
173 {
174 return name;
175 }
176
177 /*}}}************************************************************************/
178 /*{{{ print_process_declaration() */
179 /* */
180 /* */
181 /****************************************************************************/
182 static chain_list *print_process_declaration(FILE *fp, biabl_list *biabl,
183 char *name, int np, char *head,
184 char **buffer,ptype_list*clock)
185 {
186 biabl_list *biablx;
187 chain_list *temp_expr;
188 chain_list *temp_support;
189
190 iprint(fp,'i',"%s%d: PROCESS (",head,np);
191 temp_expr = createExpr(OR);
192 for(biablx = biabl; biablx; biablx = biablx->NEXT)
193 {
194 if (biablx->CNDABL)
195 addQExpr(temp_expr,copyExpr(biablx->CNDABL));
196 else
197 beh_toolbug(19,"print_process_declaration",name,0);
198 if (biablx->VALABL)
199 addQExpr(temp_expr,copyExpr(biablx->VALABL));
200 else
201 beh_toolbug(20,"print_process_declaration",name,0);
202 }
203 sprintf(*buffer,"%d",np);
204 temp_support = supportChain_listExpr(temp_expr);
205 writelist(fp, temp_support, 14 + strlen(*buffer));
206 fprintf(fp,")\n");
207 freechain(temp_support);
208 freeExpr(temp_expr);
209
210 return NULL;
211 }
212
213 /*}}}************************************************************************/
214 /*{{{ Process driving */
215 /****************************************************************************/
216 static void print_procBegin(FILE *fp, chain_list *loopchain)
217 {
218 loopchain = NULL;
219 iprint(fp,'i',"BEGIN\n");
220 }
221
222 static void print_procEnd(FILE *fp)
223 {
224 iprint(fp,'-',"END PROCESS;\n");
225 }
226
227 static void print_procIf(FILE *fp, char *buffer)
228 {
229 iprint(fp,'+',"IF %s THEN\n",bvl_printabl(buffer));
230 }
231
232 static void print_procElsif(FILE *fp, char *buffer)
233 {
234 iprint(fp,'+',"ELSIF %s THEN\n",bvl_printabl(buffer));
235 }
236
237 static int print_procElse(FILE *fp)
238 {
239 iprint(fp,'+',"ELSE\n");
240
241 return 1;
242 }
243
244 static int print_procEndif(FILE *fp, char ind)
245 {
246 iprint(fp,ind,"END IF;\n");
247
248 return 1;
249 }
250
251 static int print_edge(char *buffer, char *ckname, char ckstate,
252 char *signame)
253 {
254 sprintf(buffer,"(%s = '%c' and %s'EVENT)",ckname,ckstate,signame);
255
256 return 1;
257 }
258
259 /*}}}************************************************************************/
260 /*{{{ Ports driving */
261 /* */
262 /* */
263 /****************************************************************************/
264
265 static void port_begin(FILE *fp)
266 {
267 iprint(fp,'+',"PORT (\n");
268 }
269
270 static void port_end(FILE *fp)
271 {
272 fprintf(fp,"\n");
273 iprint(fp,'<',");\n");
274 }
275
276 /*}}}************************************************************************/
277 /*{{{ print_endLoop() */
278 /* */
279 /* */
280 /****************************************************************************/
281 static void print_endLoop(FILE *fp,char indent,char *head,int np,int cpt,
282 int nbsame,loop_list *loop)
283 {
284 int ind;
285
286 if (loop)
287 {
288 if (nbsame <= 0)
289 {
290 ind = BVL_LOOP_IND[-- BVL_CPT_IND];
291 iprint(fp,indent,"END LOOP %s%dLOOP%d;\n", head, np, ind);
292 }
293 cpt --;
294 print_endLoop(fp,indent,head,np,cpt,nbsame-1,loop->NEXT);
295 }
296 }
297
298 /*}}}************************************************************************/
299 /*{{{ print_loopList() */
300 /* */
301 /* */
302 /****************************************************************************/
303 static void print_loopList(FILE *fp,char indent,char *head,int np,int *cpt,
304 int nbsame,loop_list *loop)
305 {
306 if (loop)
307 {
308 if (nbsame <= 0)
309 print_loop(fp,indent,head,np,cpt,loop);
310 print_loopList(fp,indent,head,np,cpt,nbsame - 1,loop->NEXT);
311 }
312 }
313
314 /*}}}************************************************************************/
315 /*{{{ print_loop() */
316 /* */
317 /* */
318 /****************************************************************************/
319 static void print_loop(FILE *fp,char indent,char *head,int np,int *cpt,
320 loop_list *loop)
321 {
322 int left, right;
323 char *name;
324
325 name = loop->VARNAME;
326 left = loop->LEFT;
327 right = loop->RIGHT;
328 iprint(fp, indent, "%s%dLOOP%d : FOR %s IN %d %s %d LOOP\n",
329 head, np, *cpt, name, left, (left > right)?"DOWNTO":"TO", right);
330 BVL_LOOP_IND[BVL_CPT_IND ++] = *cpt;
331 *cpt = *cpt + 1;
332 }
333
334 /*}}}************************************************************************/
335 /*{{{ print_withselect() */
336 /* */
337 /* */
338 /****************************************************************************/
339 void print_withselect(FILE *fp, biabl_list *biabl, char *name, int vectsize,
340 char **buffer, int *bufsize)
341 {
342 char buf[4096];
343 int cpt = 1;
344
345 *buffer[0] = '\0';
346 *buffer = bvl_abl2str(biabl->CNDABL,*buffer,bufsize);
347 iprint(fp,'i',"WITH %s SELECT\n",bvl_printabl(*buffer));
348 iprint(fp,'+',"%s <=\n",name);
349
350 for (;biabl;biabl=biabl->NEXT, cpt ++)
351 {
352 if (biabl->VALABL == NULL)
353 beh_toolbug(20,"print_withselect",name,0);
354
355 *buffer[0] = '\0';
356 *buffer = bvl_abl2str(biabl->VALABL,*buffer,bufsize);
357 iprint (fp,0,"%s",bvl_printabl(*buffer));
358 print_time(fp,biabl->TIME,0,0);
359 if (biabl->FLAG&BEH_CND_SEL_OTHERS)
360 fprintf(fp," WHEN OTHERS");
361 else if (biabl->FLAG&BEH_CND_SELECT)
362 fprintf(fp," WHEN %s",vhd_getBitStr(beh_getcndvectfbiabl(biabl),buf));
363 else beh_toolbug(19, "print_withselect", name, 0);
364
365 if (biabl->NEXT)
366 fprintf(fp,",\n");
367 else if (!(biabl->FLAG&BEH_CND_SEL_OTHERS))
368 {
369 fprintf(fp,",\n");
370 iprint(fp,0,"");
371 fprintHZBitStr(fp,genHZBitStr(vectsize));
372 fprintf(fp," WHEN OTHERS;\n");
373 }
374 else
375 fprintf(fp,";\n");
376 }
377 }
378
379 /*}}}************************************************************************/
380 /*{{{ print_value() */
381 /* */
382 /* */
383 /****************************************************************************/
384 void print_value(FILE *fp, chain_list *abl, char type, int time, int timer, int timef,
385 char **buffer, int *bufsize)
386 {
387 if (!abl)
388 fprintf(fp,"?;\n");
389 else
390 {
391 *buffer[0] = '\0';
392
393 if (BVL_VECT_ASS)
394 {
395 abl = beg_compactAbl(copyExpr(abl));
396 *buffer = bvl_abl2str(abl,*buffer,bufsize);
397 freeExpr(abl);
398 }
399 else
400 *buffer = bvl_abl2str(abl,*buffer,bufsize);
401 fprintf(fp,"%s",bvl_printabl(*buffer));
402 print_time(fp,time,0,0);
403 fprintf(fp,";\n");
404 }
405
406 type = 0;
407 }
408
409 /*}}}************************************************************************/
410 /*{{{ print_affected() */
411 /* */
412 /* */
413 /****************************************************************************/
414 static void print_affected(FILE *fp, char indent, char type, int time,int timer, int timef,
415 char *name, char *vname, loop_list *loop,long specialflags)
416 {
417 if (vname == name)
418 iprint(fp,indent,"%s <= ",bvl_vectorize(name));
419 else if (loop && loop->INDEX)
420 iprint(fp,indent,"%s (%s) <= ",name,loop->INDEX);
421 else
422 iprint(fp,indent,"%s <= ",vname);
423
424 type = 0;
425 time = 0;
426 }
427
428 static char *bvl_vectorize_sub(char *name, char *buf)
429 {
430 strcpy(buf, bvl_vectorize(name));
431 return buf;
432 }
433
434 /*}}}************************************************************************/
435 /*{{{ print_signal() */
436 /* */
437 /* */
438 /****************************************************************************/
439 static void print_signal(FILE *fp, char *name, char type, int left, int right)
440 {
441 char *way;
442
443 switch (type)
444 {
445 case 'P' :
446 case 'R' :
447 case 'r' :
448 case 'W' :
449 iprint(fp,'d',"SIGNAL %s : ",bvl_vhdlname(name));
450 if (left != -1)
451 {
452 if (left >= right)
453 way = "DOWNTO";
454 else
455 way = "TO";
456
457 fprintf(fp,"STD_LOGIC_VECTOR (%d %s %d);\n",left,way,right);
458 }
459 else
460 fprintf(fp,"STD_LOGIC;\n");
461 case 'B':
462 default:
463 break;
464 }
465 }
466
467 /*}}}************************************************************************/
468 /*{{{ print_por() */
469 /* */
470 /* */
471 /****************************************************************************/
472 static void print_por(FILE *fp, char *name, char dir, int left, int right)
473 {
474 char *way, *mode;
475
476 switch (dir)
477 {
478 case 'I' :
479 mode = "in";
480 break;
481 case 'O' : case 'Z' :
482 mode = "out";
483 break;
484 case 'B' : case 'T' :
485 mode = "inout";
486 break;
487 default:
488 mode = "linkage";
489 break;
490 }
491 iprint(fp,'d',"%s : %-5s ",bvl_vhdlname(name),mode);
492
493 if (left != -1)
494 {
495 if (left >= right)
496 way = "DOWNTO";
497 else
498 way = "TO";
499
500 fprintf(fp,"STD_LOGIC_VECTOR (%d %s %d)",left,way,right);
501 }
502 else
503 fprintf(fp,"STD_LOGIC");
504 }
505
506 /*}}}************************************************************************/
507 /*{{{ print_por() */
508 /* */
509 /* */
510 /****************************************************************************/
511 static void print_interassign(FILE *fp, char *dest, char *src, int mode)
512 {
513 return;
514 fp = NULL;
515 dest = NULL;
516 src = NULL;
517 mode = 0;
518 }
519
520 /*}}}************************************************************************/
521 /*}}}************************************************************************/
522 /*}}}************************************************************************/
523 /*{{{ Traitement de la begen */
524 /****************************************************************************/
525 /*{{{ begen_treatment() */
526 /* */
527 /* */
528 /****************************************************************************/
529 static void
530 begen_treatment(FILE *fp, befig_list *figure)
531 {
532 begen_list *gen;
533
534 gen = figure->BEGEN;
535
536 iprint(fp,'i',NULL);
537 if (gen)
538 {
539 iprint(fp,'+',"GENERIC (\n");
540
541 for (gen = figure->BEGEN; gen->NEXT; gen = gen->NEXT)
542 iprint(fp,'0',"CONSTANT %s : %s := %ld ;\t-- %s\n",
543 gen->NAME,gen->TYPE,*((long *)gen->VALUE),gen->NAME);
544
545 iprint(fp,'-',"CONSTANT %s : %s := %ld \t-- %s\n",
546 gen->NAME,gen->TYPE,*((long *)gen->VALUE),gen->NAME);
547 iprint(fp,'-',"); \n");
548 }
549 }
550
551 /*}}}************************************************************************/
552 /*}}}************************************************************************/
553 /*{{{ Traitement des messages */
554 /****************************************************************************/
555 /*{{{ print_msg() */
556 /* */
557 /* */
558 /****************************************************************************/
559 void print_msg(FILE *fp, befig_list *figure, char **buffer, int *bufsize)
560 {
561 // int bufsize = 512;
562 // char *buffer;
563 bemsg_list *msg; /* current BEMSG pointer */
564 char *clock;
565 chain_list *ptcondabl;
566
567 // buffer = mbkalloc(bufsize);
568
569 for (iprint(fp,'i',"\n"), msg = figure->BEMSG; msg; msg = msg->NEXT)
570 {
571 int sndckcnd;
572 int isedge;
573 chain_list *abl_red;
574
575 iprint(fp,'i',NULL);
576 sndckcnd = 0;
577 abl_red = NULL;
578
579 if (msg->LABEL)
580 iprint(fp,'+',"%s : ASSERT (",msg->LABEL);
581 else
582 iprint(fp,'+',"ASSERT (");
583
584 *buffer[0] = '\0';
585 if ((isedge = bef_search_stable(msg->ABL,&clock)))
586 {
587 char ckstate, *ckname;
588 int attrib;
589
590 ckname = bvl_vhdlname(clock);
591 ckstate = (bef_search_notck(msg->ABL,clock) > 0) ? '0' : '1';
592 attrib = bef_get_stable_attribute(msg->ABL,&clock);
593 if (attrib)
594 sprintf(*buffer,"%s = '%c' and not %s'STABLE(%d %s)",
595 ckname,ckstate,ckname,attrib,TIME_UNIT);
596 else
597 sprintf(*buffer,"%s = '%c' and %s'EVENT",ckname,ckstate,ckname);
598
599 ptcondabl = bef_strip_ckedge(msg->ABL,clock);
600 sndckcnd = ( ! ( ATOM(ptcondabl) &&
601 ! ( strcmp (VALUE_ATOM (ptcondabl), "'1'") &&
602 strcmp (VALUE_ATOM (ptcondabl), "'0'"))));
603 if (sndckcnd)
604 (void) fprintf(fp,"%s and ",bvl_printabl(*buffer));
605 else
606 (void) fprintf(fp,"%s",bvl_printabl(*buffer));
607 }
608
609 if (sndckcnd)
610 {
611 abl_red = bef_preprocess_abl(ptcondabl);
612 freeExpr(ptcondabl);
613 }
614 if (!isedge)
615 abl_red = msg->ABL;
616 if (abl_red)
617 {
618 *buffer[0] = '\0';
619 *buffer = bvl_abl2strbool(abl_red,*buffer,bufsize);
620 (void) fprintf(fp,"%s",bvl_printabl(*buffer));
621 if (sndckcnd)
622 freeExpr(abl_red);
623 }
624 (void) fprintf(fp,")\n");
625
626 if (msg->MESSAGE)
627 iprint(fp,'+',"REPORT %s\n",msg->MESSAGE);
628 if (msg->LEVEL == 'W')
629 iprint(fp,'-',"SEVERITY WARNING;\n");
630 else
631 iprint(fp,'-',"SEVERITY ERROR;\n");
632 }
633 // mbkfree(buffer);
634 }
635
636 /*}}}************************************************************************/
637 /*{{{ vhd_initDriver() */
638 /* */
639 /* */
640 /****************************************************************************/
641 void vhd_initDriver(bef_driver *driver, FILE *fp, befig_list *fig, ht *porht,
642 char **buffer, int *bufsize)
643 {
644 bef_driverSet(driver,fp,fig,buffer,bufsize,
645 print_time,
646 print_endLoop,
647 print_loopList,
648 print_loop,
649 print_value,
650 print_affected,
651 print_signal,
652 print_interassign,
653 isone);
654 bef_driverSetAbl(driver,
655 bvl_abl2strbool);
656 bef_driverSetProcess(driver,
657 print_withselect,
658 print_process_declaration,
659 print_procBegin,
660 print_procEnd,
661 print_procIf,
662 print_procElsif,
663 print_procElse,
664 print_procEndif,
665 print_edge);
666 bef_driverSetStr(driver,
667 bvl_vhdlname,
668 beh_buildvhdvectname,
669 bvl_vectorize_sub,
670 vhd_getBitStr,
671 vhd_bebusname,
672 vhd_beregname);
673 bef_driverSetPor(driver,
674 print_por,
675 port_end,
676 port_begin,
677 porht);
678 driver->VLG=0;
679 }
680
681 /*}}}************************************************************************/
682 /*}}}************************************************************************/
683 /*{{{ Function de drive */
684 /****************************************************************************/
685 /*{{{ vhdsavebefig() */
686 /* */
687 /* description : print out a text file containing a data-flow VHDL */
688 /* description */
689 /****************************************************************************/
690 void
691 vhdsavebefig(befig_list *pthedbefig, unsigned int trace_mode)
692 {
693 char *suffix, *str;
694 char *buffer;
695 int bufsize;
696 FILE *fp;
697 ht *vhdportht;
698 bef_driver driver;
699
700 BVL_VECT_ASS = (int)(long)getenv("DRI_VECT_ASS");
701
702 if (pthedbefig == NULL)
703 beh_toolbug(10, "vhdsavebefig", NULL, 0);
704
705 suffix = V_STR_TAB[__BVL_FILE_SUFFIX].VALUE;
706 if (suffix == NULL) suffix = namealloc("vhd");
707
708 /* ###------------------------------------------------------### */
709 /* Opening result file */
710 /* ###------------------------------------------------------### */
711
712 if (!(fp = mbkfopen(bvl_vhdlname(pthedbefig->NAME),suffix,WRITE_TEXT)))
713 {
714 beh_error(107, NULL);
715 EXIT(1);
716 }
717
718 vhdportht = addht(40);
719
720 bufsize = 512;
721 buffer = mbkalloc(bufsize);
722 vhd_initDriver(&driver,fp,pthedbefig,vhdportht,&buffer,&bufsize);
723
724 if ((trace_mode & BVL_TRACE) != 0)
725 (void) fprintf(stdout, "Saving '%s' in a vhdl file (vhd)\n",
726 pthedbefig->NAME);
727
728 sprintf(buffer,"VHDL data flow description generated from `%s`\n",
729 pthedbefig->NAME);
730 avt_printExecInfo(fp, "--", buffer, "");
731
732 (void) fprintf(fp, "library IEEE;\nuse IEEE.std_logic_1164.all;\n\n");
733
734 /* ###------------------------------------------------------### */
735 /* Entity declaration */
736 /* ###------------------------------------------------------### */
737
738 iprint(fp,'i',"-- Entity Declaration\n\n");
739 iprint(fp,'i',"ENTITY %s IS\n",bvl_vhdlname(pthedbefig->NAME));
740
741 /* ###------------------------------------------------------### */
742 /* begen declaration */
743 /* ###------------------------------------------------------### */
744
745 begen_treatment(fp, pthedbefig);
746
747 /* ###------------------------------------------------------### */
748 /* Port declaration */
749 /* ###------------------------------------------------------### */
750
751 bef_drive_porDeclaration(&driver);
752
753 iprint(fp,'i',"END %s;\n\n", bvl_vhdlname(pthedbefig->NAME));
754
755 /* ###------------------------------------------------------### */
756 /* Architecture declaration */
757 /* ###------------------------------------------------------### */
758
759 iprint(fp,'i',"-- Architecture Declaration\n\n");
760 iprint(fp,'i',"ARCHITECTURE RTL OF %s IS\n",bvl_vhdlname(pthedbefig->NAME));
761
762 /* ###------------------------------------------------------### */
763 /* Signals declaration */
764 /* ###------------------------------------------------------### */
765
766 bef_drive_sigDeclaration(&driver);
767
768 delht(vhdportht);
769 vhdportht = NULL;
770
771 (void) fprintf(fp, "\nBEGIN\n");
772
773 TIME_UNIT = bef_gettimeunit(pthedbefig->TIME_UNIT);
774
775 /* ###------------------------------------------------------### */
776 /* Print out a concurrent assert statement for each BEMSG */
777 /* ###------------------------------------------------------### */
778
779 print_msg(fp,pthedbefig,&buffer,&bufsize);
780
781 bef_drive_aux(&driver);
782 bef_drive_reg(&driver);
783 bef_drive_bux(&driver);
784 bef_drive_bus(&driver);
785 bef_drive_out(&driver);
786
787 (void) fprintf(fp, "\nEND;\n");
788 (void) fclose(fp);
789
790 if (V_BOOL_TAB[__API_DRIVE_CORRESP].VALUE)
791 bvl_drivecorresp(pthedbefig->NAME, pthedbefig, 0);
792
793 bvl_freenames();
794 mbkfree(buffer);
795 }
796
797 /*}}}************************************************************************/
798 /*}}}************************************************************************/
799 /*{{{ Obsolete */
800 /****************************************************************************/
801 /*{{{ print_one_bebus() */
802 /* */
803 /* */
804 /****************************************************************************/
805 void print_one_bebus(FILE *fp, bebus_list *bus, int *numprocess)
806 {
807 bef_driver driver;
808 char *buffer;
809 int bufsize;
810
811 bufsize = 512;
812 buffer = mbkalloc(bufsize);
813 vhd_initDriver(&driver,fp,NULL,NULL,&buffer,&bufsize);
814
815 bef_print_one_beobj(&driver,bus,numprocess,BEG_TYPE_SINGBUS);
816 mbkfree(buffer);
817 }
818
819 /*}}}************************************************************************/
820 /*{{{ print_one_bebux() */
821 /* */
822 /* */
823 /****************************************************************************/
824 void print_one_bebux(FILE *fp, bebux_list *bux, int *numprocess)
825 {
826 bef_driver driver;
827 char *buffer;
828 int bufsize;
829
830 bufsize = 512;
831 buffer = mbkalloc(bufsize);
832 vhd_initDriver(&driver,fp,NULL,NULL,&buffer,&bufsize);
833
834 bef_print_one_beobj(&driver,bux,numprocess,BEG_TYPE_SINGBUX);
835 mbkfree(buffer);
836 }
837
838 /*}}}************************************************************************/
839 /*{{{ print_one_bereg() */
840 /* */
841 /* exploit priority encoding */
842 /****************************************************************************/
843 void print_one_bereg(FILE *fp, bereg_list *reg, int *numprocess)
844 {
845 bef_driver driver;
846 char *buffer;
847 int bufsize;
848
849 bufsize = 512;
850 buffer = mbkalloc(bufsize);
851 vhd_initDriver(&driver,fp,NULL,NULL,&buffer,&bufsize);
852
853 bef_print_one_beobj(&driver,reg,numprocess,BEG_TYPE_SINGREG);
854 mbkfree(buffer);
855 }
856
857 /*}}}************************************************************************/
858 /*{{{ print_one_beaux() */
859 /* */
860 /* */
861 /****************************************************************************/
862 void print_one_beaux(FILE *fp, beaux_list *aux)
863 {
864 bef_driver driver;
865 char *buffer;
866 int bufsize;
867
868 bufsize = 512;
869 buffer = mbkalloc(bufsize);
870 vhd_initDriver(&driver,fp,NULL,NULL,&buffer,&bufsize);
871
872 bef_print_one_beobj(&driver, aux, NULL, BEG_TYPE_SINGAUX);
873 mbkfree(buffer);
874 }
875
876 /*}}}************************************************************************/
877 /*{{{ print_one_bevectaux() */
878 /* */
879 /* */
880 /****************************************************************************/
881 void print_one_bevectaux(FILE *fp, bevectaux_list *vaux)
882 {
883 bef_driver driver;
884 char *buffer;
885 int bufsize;
886
887 bufsize = 512;
888 buffer = mbkalloc(bufsize);
889 vhd_initDriver(&driver,fp,NULL,NULL,&buffer,&bufsize);
890
891 bef_print_one_beobj(&driver, vaux, NULL, BEG_TYPE_VECTAUX);
892 mbkfree(buffer);
893 }
894
895 /*}}}************************************************************************/
896 /*{{{ print_one_beout() */
897 /* */
898 /* affectation des signaux beout */
899 /****************************************************************************/
900 void print_one_beout(FILE *fp, beout_list *out)
901 {
902 bef_driver driver;
903 char *buffer;
904 int bufsize;
905
906 bufsize = 512;
907 buffer = mbkalloc(bufsize);
908 vhd_initDriver(&driver,fp,NULL,NULL,&buffer,&bufsize);
909
910 bef_print_one_beobj(&driver, out, NULL, BEG_TYPE_SINGOUT);
911 mbkfree(buffer);
912 }
913
914 /*}}}************************************************************************/
915 /*{{{ print_one_bevectout() */
916 /* */
917 /* */
918 /****************************************************************************/
919 void print_one_bevectout(FILE *fp, bevectout_list *vout)
920 {
921 bef_driver driver;
922 char *buffer;
923 int bufsize;
924
925 bufsize = 512;
926 buffer = mbkalloc(bufsize);
927 vhd_initDriver(&driver,fp,NULL,NULL,&buffer,&bufsize);
928
929 bef_print_one_beobj(&driver, vout, NULL, BEG_TYPE_VECTOUT);
930 mbkfree(buffer);
931 }
932
933 /*}}}************************************************************************/
934 /*}}}************************************************************************/