premiere entree de pcbs!!!!!

This commit is contained in:
Francois Donnet 2002-05-29 15:07:38 +00:00
parent 1918cb6261
commit 7e3867a4f2
72 changed files with 15983 additions and 0 deletions

View File

@ -0,0 +1,3 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = doc src

View File

@ -0,0 +1,52 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/pcbs/pcbs.c)
EMULBS_MAJOR_VERSION=3
EMULBS_MINOR_VERSION=1
EMULBS_VERSION=$EMULBS_MAJOR_VERSION.$EMULBS_MINOR_VERSION
AC_SUBST(EMULBS_MAJOR_VERSION)
AC_SUBST(EMULBS_MINOR_VERSION)
AC_SUBST(EMULBS_VERSION)
PCBS_MAJOR_VERSION=2
PCBS_MINOR_VERSION=1
PCBS_VERSION=$PCBS_MAJOR_VERSION.$PCBS_MINOR_VERSION
AC_SUBST(PCBS_MAJOR_VERSION)
AC_SUBST(PCBS_MINOR_VERSION)
AC_SUBST(PCBS_VERSION)
# For automake.
VERSION=$PCBS_VERSION
PACKAGE=pcbs
dnl Initialize automake stuff
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB
AM_PROG_LEX
AC_PROG_YACC
AC_PROG_MAKE_SET
dnl Checks for libraries.
dnl Check for -lm librarie. These should always be present.
AC_CHECK_LIB(m, exp)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
dnl path for libs and includes
AM_ALLIANCE
AC_OUTPUT([
Makefile
doc/Makefile
src/Makefile
src/pcbs/Makefile
src/emulbs/Makefile
src/bvl/Makefile
])

View File

@ -0,0 +1,4 @@
## Process this file with automake to produce Makefile.in
man_MANS = emulbs.1 pcbs.1
EXTRA_DIST = $(man_MANS)

View File

@ -0,0 +1,118 @@
.\" @(#)PCBS.1 3.1 April 2001 UPMC; Author: DONNET Francois
.TH EMULBS 1 "February 2002" "Release 3.1" "CAO\-VLSI Reference Manual"
.SH NAME
.PP
\fIPcBs\fP, Emulated Boundary-Scan Tester Platform.
.so man1/alc_origin.1
.SH SYNOPSIS
.PP
\f4emulbs\fP [ -hvc ] [ \-l <\fInumber\fP> ] [ -b <\fInumber\fP> ] [ <\fIsource.PAT\fP> ]
[ -e <\fIconnections_file\fP> [ -s <\fIbs.PAT\fP> ] ]
[ \-\-pci <\fIres.PAT\fP> | \-\-parallel <\fIres.PAT\fP> ]
.SH DESCRIPTION
.PP
\f4emulbs\fP is a tool addressing a Boundary Scan card connected to the PC Printer
parallel interface or to the pci bus interface. This tool is able to :
.PP
\- Automatically check the Boundary\-scan device for Instruction register length, Bypass register length and Boundary\-scan register length,
.PP
\- Execute Boundary\-scan patterns directly to the device,
.PP
\- Translate functionnal patterns to Boundary\-scan patterns using an ASCII description of the device Boundary\-scan architecture for the specific emulbs31 card.
.PP
To use this tool, you don't need to have a particular knowledge of Boundary-scan architecture.
The lpscan driver should be installed if you want to use the parallel port.
.PP
If it cannot communicate with the device, \f4emulbs\fP will output an error message
like :
.PP
.nf
Cannot check INSTRUCTION Register (longer than xxxx bits ???)
Check the card connection
.fi
.SH DEFINITION
.PP
We call "\f4Boundary\-scan patterns\fP" patterns written for a device with Boundary\-scan architecture using only the Test Acess Port interface (i.e TDI, TDO, TMS, TCK and eventually TRST).
.br
We call "\f4Functionnal patterns\fP" patterns written for a device with Boundary\-
scan architecture, but using the fonctionnal interface of the device or for a chip branched with the specific EMULBS31 card which emulated the boundary-scan device(--emulbs option).
.SH OPTION
.TP 10
\f4\-h,\-\-help\fP
Help mode. Displays possible uses of \f4emulbs\fP.
.TP 10
\f4\-v,\-\-verbose\fP
Verbose mode. Dump executed patterns as \f4asimut\fP.
.TP 10
\f4\-c,\-\-check\fP
Check the boundary scan device by sending some patterns. It's able to guess the kind of boundary-scan card is in use (instruction length, bypass length, boundary-scan length).
.TP 10
\f4\-l,\-\-load\fP <number>
Do not load all patterns in memory but do it by sequences of <number> patterns.
Boundary-scan patterns are well known to be huge. It's a way to save memory.
.TP 10
\f4\-b,\-\-burst\fP <number>
When you are using a pci bus, you can choose the size in words of your dma burst.
It's a nonsense to use this option with a parallel port.
.TP 10
\f4\-e,\-\-emulbs\fP <connections_file>
<connections_file> describes the device connections between the tested chip and the test card. Functional patterns in <source.PAT> will be serialized in boundary-scan patterns.
.TP 10
\f4\-s,\-\-save\fP <connections_file>
Save the produced boundary-scan patterns in the file <bs.PAT>.
This option should be used with \f4\-e,\-\-emulbs\fP.
.TP 10
\f4\--pci\fP <res.PAT>
To select the pci port where the test card is connected.
Results of testing <source.PAT> will be saved in the file <res.PAT>.
.TP 10
\f4\--parallel\fP <res.PAT>
To select the parallel port where the test card is connected.
Results of testing <source.PAT> will be saved in the file <res.PAT>.
.SH EMULBS CONNECTIONS FILE
.nf
--example for emulbs connexions file
--left-hand is for EMULBS connector
--right-hand is for CHIP connector
0 <=in ck ;
185 <=out y ;
56 <=in i(0);
76 <=in i(1);
80 <=inout sh ;
.fi
.SH SEE ALSO
.PP
pat(5), asimut(1)
.so man1/alc_bug_report.1

View File

@ -0,0 +1,127 @@
.\" @(#)PCBS.1 2.0 April 1998 UPMC; Author: DONNET F.
.TH PCBS 1 "April 1998" "Release 2.0" "CAO\-VLSI Reference Manual"
.SH NAME
.PP
\fIpcbs\fP, PC/Boundary-Scan Tester Platform.
.so man1/alc_origin.1
.SH SYNOPSIS
.PP
\fBpcbs\fP \-\-check [-b <\fIBSDL\fP> | -e <\fIemul\fP> <\fIpga\fP>]
.PP
\fBpcbs\fP \-\-execute <\fIsource.PAT\fP> [<\fIdestination.PAT\fP>]
.PP
\fBpcbs\fP \-\-bsdl <\fIBSDL\fP> <\fIsource.PAT\fP> <\fIdestination.PAT\fP>
.PP
\fBpcbs\fP \-\-emulbs <\fIemul\fP> <\fIpga\fP> <\fIsource.PAT\fP> <\fIdestination.PAT\fP>
.SH DESCRIPTION
.PP
\fBpcbs\fP is a tool addressing a Boundary Scan card connected to the PC Printer
parallel interface. This tool is able to :
.PP
\- Automatically check the Boundary\-scan device for Instruction register length, Bypass register length and Boundary\-scan register length,
.PP
\- Execute Boundary\-scan patterns directly to the device,
.PP
\- Translate functionnal patterns to Boundary\-scan patterns using a BSDL description of the device Boundary\-scan architecture,
.PP
\- Translate functionnal patterns to Boundary\-scan patterns using an ASCII description of the device Boundary\-scan architecture for the specific emulbs31 card,
.PP
To use this tool, you must have a strong knowledge of Boundary-scan architecture
and eventually Boundary\-scan Description Language.
.SH DEFINITION
.PP
We call "\fBBoundary\-scan patterns\fP" patterns written for a device with Boundary\-scan architecture using only the Test Acess Port interface (i.e TDI, TDO, TMS, TCK and eventually TRST).
.br
We call "\fBFunctionnal patterns\fP" patterns written for a device with Boundary\-
scan architecture(case of --bsdl option), but using the fonctionnal interface of the device or for a chip branched with the specific EMULBS31 card which emulated the boundary-scan device(--emulbs option).
.SH CHECK MODE
.PP
\fBpcbs\fP \-\-check [-b <\fIBSDL\fP> | -e <\fIemul\fP> <\fIpga\fP>]
\fBpcbs\fP will send special patterns to the Boundary\-scan device to find by itself
the Instruction register length, the Bypass register length and the
Boundary\-scan register length. If a <\fIbsdl\fP> file is provided, it will compare
the found values against the <\fIbsdl\fP> or <\fIemul\fP> + <\fIpga\fP> ones.
See BSDL MODE or EMULBS MODE for more informations about these files.
.PP
If it cannot communicate with the device, \fBpcbs\fP will output an error message
like :
.PP
.nf
Cannot check INSTRUCTION Register (longer than xxxx bits ???)
Check the card connection
.fi
.SH EXECUTION MODE
.PP
\fBpcbs\fP \-\-execute [\-vp] <\fIsource.PAT\fP> [ [\-fs] <\fIdestination.PAT\fP>]
\fBpcbs\fP will send the "\fBBoundary\-scan patterns\fP" <\fIsource.PAT\fP> to the device.
The EXECUTION MODE can be used with the BSDL MODE or EMULBS MODE to translate the
functionnal patterns and send them directly to the device.\n
.br
If <\fIdestination.PAT\fP> is specified, it will save the results with format boundary(\-s) or functionnal(\-f).
\-v or \-\-verbose mode display all behaves and warnings. It is very verbose, so use it only for debugging your patterns.\n
.br
\-p or \-\-pattern followed by a number is to indicate the number of patterns to be loaded in memory in one sequence. It's an evidence you must decrease this number if you have problem of memory and swapping(\-p=50 for example). you should also raise it if you are free of (\-p all for example).
.SH BSDL MODE
.PP
\fBpcbs\fP \-\-bsdl [\-vp] <\fIBSDL\fP> <\fIsource.PAT\fP> <\fIdestination.PAT\fP>
\fBpcbs\fP will translate "\fBFunctionnal patterns\fP" <\fIsource.PAT\fP> to
"\fBBoundary\-scan patterns\fP" <\fIdestination.PAT\fP> (see DEFINITIONS) using a
Boundary-Scan Description Language file <\fIBSDL\fP>.
.br
\-v or \-\-verbose mode display all behaves and warnings. It is very verbose, so use it only for debugging your patterns.
.br
\-p or \-\-pattern followed by a number is to indicate the number of patterns to be loaded in memory in one sequence. It's an evidence you must decrease this number if you have problem of memory and swapping(\-p=50 for example). you should also raise it if you are free of (\-p all for example).
.SH EMULBS MODE
.PP
\fBpcbs\fP \-\-emulbs [-vp] <\fIemul\fP> <\fIpga\fP> <\fIsource.PAT\fP> <\fIdestination.PAT\fP>
\fBpcbs\fP will translate "\fBFunctionnal patterns\fP" <\fIsource.PAT\fP> to
"\fBBoundary\-scan patterns\fP" <\fIdestination.PAT\fP> (see DEFINITIONS) using
ASCII description files. Users have to give connexions between the PGA block and the emulbs31 card and also between the PGA and the chip.
\fBpcbs\fP runs faster if your connexions are only on some emulbs31 because of bypass.
.br
\-v or \-\-verbose mode display all behaves and warnings. It is very verbose, so use it only for debugging your patterns.
.br
\-p or \-\-pattern followed by a number is to indicate the number of patterns to be loaded in memory in one sequence. It's an evidence you must decrease this number if you have problem of memory and swapping(\-p=50 for example). you should also raise it if you are free of (\-p all for example).
.nf
--example for emul connexions file | --example for chip connexions file
--left-hand is for EMULBS connector| --left-hand is for PGA connector
--right-hand is for PGA connector | --right-hand is for CHIP connector
|
pcbs emul_connexions V2.0; | pcbs pga_connexions version 2.0;
0 <=a:1 ; | a:1 <=in ck ;
185 <=r:16; | r:16<=out y ;
56 <=d:5 ; | d:4 <=in i(0);
76 <=d:4 ; | d:5 <=in i[1];
80 <=g:2 ; | g:2 <=inout sh ;
Vdd <=e:6 ; | e:6 <=in d_Vdd ;
d_Vss<=a:2 ; | a:2 <=in d_Vss ;
.fi
.SH SEE ALSO
.PP
pat(5), asimut(1), bsdl(5)
.so man1/alc_bug_report.1

View File

@ -0,0 +1,3 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = bvl pcbs emulbs

View File

@ -0,0 +1,24 @@
## Process this file with automake to produce Makefile.in
YACC = @YACC@ -d
AM_CFLAGS = @ALLIANCE_CFLAGS@
CLEANFILES = bvl_bcomp_y.c bvl_bcomp_y.h bvl_bcomp_l.c y.tab.h y.tab.c
noinst_LIBRARIES = libBvl.a
libBvl_a_SOURCES = bvl999.h bvl_blex.h bvl_drive.c bvl_utdef.h \
bvl_bcomp_l.l bvl_bspec.c bvl_drive.h bvl_util.c \
bvl_bcomp_y.y bvl_bspec.h bvl_parse.c bvl_util.h \
bvl_bedef.h bvl_byacc.h bvl_parse.h bvl_utype.h
bvl_bcomp_y.c bvl_bcomp_y.h : $(srcdir)/bvl_bcomp_y.y
$(YACC) $(YFLAGS) $(srcdir)/bvl_bcomp_y.y && sed -e "s/yy/bvl_y_/g" -e "s/YY/BVL_Y_/g" y.tab.c > bvl_bcomp_y.c && sed -e "s/yy/bvl_y_/g" -e "s/YY/BVL_Y_/g" y.tab.h > bvl_bcomp_y.h
bvl_bcomp_l.c : $(srcdir)/bvl_bcomp_l.l bvl_bcomp_y.h
$(LEX) -t $(srcdir)/bvl_bcomp_l.l | sed -e "s/yy/bvl_y_/g" -e "s/YY/BVL_Y_/g" > bvl_bcomp_l.c

View File

@ -0,0 +1,22 @@
/* ###--------------------------------------------------------------### */
/* */
/* file : bvl110.h */
/* date : Feb 10 1995 */
/* version : v110 */
/* author : Pirouz BAZARGAN SABET */
/* contents : defines and structure definitions used in BVL library */
/* */
/* ###--------------------------------------------------------------### */
#ifndef BEH_BVLDEF
#define BEH_BVLDEF
/* ###------------------------------------------------------### */
/* functions */
/* ###------------------------------------------------------### */
extern struct befig *vhdlloadbefig ();
extern void vhdlsavebefig ();
#endif

View File

@ -0,0 +1,345 @@
%{
#include <stdio.h>
#include <string.h>
#include "mut.h"
#include "beh.h"
typedef struct bvl_expr
{
char *IDENT; /* identifier or constant name */
struct chain *LIST_ABL; /* pointer on bvl_abllst list */
short WIDTH; /* width of bit vector */
}
bvl_ablstr;
typedef struct
{
char *NAME; /* identifier name */
short LEFT; /* vector's left index */
short RIGHT; /* vector's right index */
char FLAG;
}
bvl_name;
struct g_type
{
int VALU;
char FLAG;
};
#include "bvl_bcomp_y.h"
#include "bvl_blex.h"
%}
upper_case_letter [A-Z]
digit [0-9]
special_character [\#\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\_\|]
space_character [ \t]
format_effector [\t\v\r\l\f]
end_of_line \n
lower_case_letter [a-z]
other_special_character [\!\$\@\?\[\\\]\^\`\{\}\~]
graphic_character ({basic_graphic_character}|{lower_case_letter}|{other_special_character})
basic_graphic_character ({upper_case_letter}|{digit}|{special_character}|{space_character})
letter ({upper_case_letter}|{lower_case_letter})
letter_or_digit ({letter}|{digit})
decimal_literal {integer}(\.{integer})?({exponent})?
integer {digit}(_?{digit})*
exponent ([eE][-+]?{integer})
base {integer}
based_integer {extended_digit}(_?{extended_digit})*
extended_digit ({digit}|[a-fA-F])
base_specifier (B|b|O|o|X|x)
%%
\n {
/*printf ("Newline\n");*/
BVL_LINNUM++;
}
[ \t] {
/*printf ("space\n");*/
}
\& {
/*printf ("Ampersand\n");*/
return(Ampersand);
}
\' {
/*printf ("Apostrophe\n");*/
return(Apostrophe);
}
\( {
/*printf ("LeftParen\n");*/
return(LeftParen);
}
\) {
/*printf ("RightParen\n");*/
return(RightParen);
}
"**" {
/*printf ("DoubleStar\n");*/
return(DoubleStar);
}
\* {
/*printf ("Star\n");*/
return(Star);
}
\+ {
/*printf ("Plus\n");*/
return(Plus);
}
\, {
/*printf ("Comma\n");*/
return(Comma);
}
\- {
/*printf ("Minus\n");*/
return(Minus);
}
":=" {
/*printf ("VarAsgn\n");*/
return(VarAsgn);
}
\: {
/*printf ("Colon\n");*/
return(Colon);
}
\; {
/*printf ("Semicolon\n");*/
return(Semicolon);
}
"<=" {
/*printf ("_LESym\n");*/
return(_LESym);
}
">=" {
/*printf ("_GESym\n");*/
return(_GESym);
}
\< {
/*printf ("_LTSym\n");*/
return(_LTSym);
}
\> {
/*printf ("_GTSym\n");*/
return(_GTSym);
}
= {
/*printf ("_EQSym\n");*/
return(_EQSym);
}
\/= {
/*printf ("_NESym\n");*/
return(_NESym);
}
"=>" {
/*printf ("Arrow\n");*/
return(Arrow);
}
"<>" {
/*printf ("Box\n");*/
return(Box);
}
\| {
/*printf ("Bar\n");*/
return(Bar);
}
! {
/*printf ("Bar\n");*/
return(Bar);
}
\. {
/*printf ("Dot\n");*/
return(Dot);
}
\/ {
/*printf ("Slash\n");*/
return(Slash);
}
{letter}(_?{letter_or_digit})* {
int itoken;
itoken = search (yytext);
if (itoken == EMPTYHT)
{
yylval.text = namealloc (yytext);
/*printf ("Identifier : %s\n", yytext);*/
return (Identifier);
}
else
{
/*printf ("Key word : %s\n", yytext);*/
return (itoken);
}
}
({decimal_literal})|({base}#{based_integer}(\.{based_integer})?#({exponent})?)|({base}:{based_integer}(\.{based_integer})?:({exponent})?) {
yylval.text = mbkalloc ((unsigned int)strlen(yytext)+1);
strcpy (yylval.text, yytext);
return (AbstractLit);
}
'({graphic_character}|\"|\%)' {
yylval.text = namealloc (yytext);
return (CharacterLit);
}
(\"({graphic_character}|(\"\")|\%)*\")|(\%({graphic_character}|(\%\%)|\")*\%) {
yylval.text = namealloc (yytext);
return (StringLit);
}
{base_specifier}((\"{extended_digit}(_?{extended_digit})*\")|(\%{extended_digit}(_?{extended_digit})*\%)) {
yylval.text = namealloc (yytext);
return (BitStringLit);
}
\-\-.*$ {
}
. {
return (*yytext);
}
%%
/* ###--------------------------------------------------------------### */
/* function : yywrap */
/* description : return 1 */
/* called func. : none */
/* ###--------------------------------------------------------------### */
int yywrap ()
{
return (1);
}
/* ###--------------------------------------------------------------### */
/* function : search */
/* description : check that an identifier is a reserved word or not */
/* called func. : addht, addhtitem, gethtitem, namealloc */
/* ###--------------------------------------------------------------### */
static int search (key)
char *key;
{
static ht *pt_hash = NULL;
if (pt_hash == NULL)
{
pt_hash = addht (107);
addhtitem (pt_hash, namealloc("abs") , ABS );
addhtitem (pt_hash, namealloc("access") , ACCESS );
addhtitem (pt_hash, namealloc("after") , AFTER );
addhtitem (pt_hash, namealloc("alias") , ALIAS );
addhtitem (pt_hash, namealloc("all") , ALL );
addhtitem (pt_hash, namealloc("and") , _AND );
addhtitem (pt_hash, namealloc("architecture") , ARCHITECTURE );
addhtitem (pt_hash, namealloc("array") , ARRAY );
addhtitem (pt_hash, namealloc("assert") , ASSERT );
addhtitem (pt_hash, namealloc("attribute") , ATTRIBUTE );
addhtitem (pt_hash, namealloc("begin") , _BEGIN );
addhtitem (pt_hash, namealloc("bit") , BIT );
addhtitem (pt_hash, namealloc("bit_vector") , BIT_VECTOR );
addhtitem (pt_hash, namealloc("block") , BLOCK );
addhtitem (pt_hash, namealloc("body") , BODY );
addhtitem (pt_hash, namealloc("buffer") , BUFFER );
addhtitem (pt_hash, namealloc("bus") , BUS );
addhtitem (pt_hash, namealloc("case") , CASE );
addhtitem (pt_hash, namealloc("component") , COMPONENT );
addhtitem (pt_hash, namealloc("configuration"), CONFIGURATION);
addhtitem (pt_hash, namealloc("constant") , CONSTANT );
addhtitem (pt_hash, namealloc("disconnect") , DISCONNECT );
addhtitem (pt_hash, namealloc("downto") , DOWNTO );
addhtitem (pt_hash, namealloc("else") , ELSE );
addhtitem (pt_hash, namealloc("elsif") , ELSIF );
addhtitem (pt_hash, namealloc("end") , _END );
addhtitem (pt_hash, namealloc("entity") , ENTITY );
addhtitem (pt_hash, namealloc("error") , ERROR );
addhtitem (pt_hash, namealloc("exit") , _EXIT );
addhtitem (pt_hash, namealloc("file") , _FILE );
addhtitem (pt_hash, namealloc("for") , FOR );
addhtitem (pt_hash, namealloc("function") , FUNCTION );
addhtitem (pt_hash, namealloc("generate") , GENERATE );
addhtitem (pt_hash, namealloc("generic") , GENERIC );
addhtitem (pt_hash, namealloc("guarded") , GUARDED );
addhtitem (pt_hash, namealloc("if") , IF );
addhtitem (pt_hash, namealloc("in") , _IN );
addhtitem (pt_hash, namealloc("inout") , _INOUT );
addhtitem (pt_hash, namealloc("is") , IS );
addhtitem (pt_hash, namealloc("label") , _LABEL );
addhtitem (pt_hash, namealloc("library") , LIBRARY );
addhtitem (pt_hash, namealloc("linkage") , _LINKAGE );
addhtitem (pt_hash, namealloc("loop") , LOOP );
addhtitem (pt_hash, namealloc("map") , MAP );
addhtitem (pt_hash, namealloc("mod") , MOD );
addhtitem (pt_hash, namealloc("mux_bit") , MUX_BIT );
addhtitem (pt_hash, namealloc("mux_vector") , MUX_VECTOR );
addhtitem (pt_hash, namealloc("nand") , _NAND );
addhtitem (pt_hash, namealloc("natural") , NATURAL );
addhtitem (pt_hash, namealloc("new") , NEW );
addhtitem (pt_hash, namealloc("next") , _NEXT );
addhtitem (pt_hash, namealloc("nor") , _NOR );
addhtitem (pt_hash, namealloc("not") , _NOT );
addhtitem (pt_hash, namealloc("null") , _NULL );
addhtitem (pt_hash, namealloc("of") , OF );
addhtitem (pt_hash, namealloc("on") , ON );
addhtitem (pt_hash, namealloc("open") , OPEN );
addhtitem (pt_hash, namealloc("or") , _OR );
addhtitem (pt_hash, namealloc("others") , OTHERS );
addhtitem (pt_hash, namealloc("out") , _OUT );
addhtitem (pt_hash, namealloc("package") , BVL_PACKAGE );
addhtitem (pt_hash, namealloc("port") , PORT );
addhtitem (pt_hash, namealloc("procedure") , PROCEDURE );
addhtitem (pt_hash, namealloc("process") , PROCESS );
addhtitem (pt_hash, namealloc("range") , RANGE );
addhtitem (pt_hash, namealloc("record") , RECORD );
addhtitem (pt_hash, namealloc("reg_bit") , REG_BIT );
addhtitem (pt_hash, namealloc("reg_vector") , REG_VECTOR );
addhtitem (pt_hash, namealloc("register") , REGISTER );
addhtitem (pt_hash, namealloc("rem") , REM );
addhtitem (pt_hash, namealloc("report") , REPORT );
addhtitem (pt_hash, namealloc("return") , RETURN );
addhtitem (pt_hash, namealloc("select") , SELECT );
addhtitem (pt_hash, namealloc("severity") , SEVERITY );
addhtitem (pt_hash, namealloc("signal") , SIGNAL );
addhtitem (pt_hash, namealloc("stable") , _STABLE );
addhtitem (pt_hash, namealloc("subtype") , SUBTYPE );
addhtitem (pt_hash, namealloc("string") , STRING );
addhtitem (pt_hash, namealloc("then") , THEN );
addhtitem (pt_hash, namealloc("to") , TO );
addhtitem (pt_hash, namealloc("transport") , TRANSPORT );
addhtitem (pt_hash, namealloc("type") , _TYPE );
addhtitem (pt_hash, namealloc("units") , UNITS );
addhtitem (pt_hash, namealloc("until") , UNTIL );
addhtitem (pt_hash, namealloc("use") , USE );
addhtitem (pt_hash, namealloc("variable") , VARIABLE );
addhtitem (pt_hash, namealloc("wait") , WAIT );
addhtitem (pt_hash, namealloc("warning") , WARNING );
addhtitem (pt_hash, namealloc("when") , WHEN );
addhtitem (pt_hash, namealloc("while") , WHILE );
addhtitem (pt_hash, namealloc("with") , WITH );
addhtitem (pt_hash, namealloc("wor_bit") , WOR_BIT );
addhtitem (pt_hash, namealloc("wor_vector") , WOR_VECTOR );
addhtitem (pt_hash, namealloc("xor") , _XOR );
}
return (gethtitem (pt_hash, namealloc(key)));
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,58 @@
/* ###--------------------------------------------------------------### */
/* */
/* file : bvl_bedef.h */
/* date : Jan 18 1993 */
/* version : v106 */
/* author : P.BAZARGAN, L.A.TABUSSE, VUONG H.N. */
/* content : declaration of define used by yacc */
/* */
/* ###--------------------------------------------------------------### */
#define BVL_ICNDFN 1 /* input port */
#define BVL_OCNDFN 2 /* output port */
#define BVL_BCNDFN 3 /* inout port */
#define BVL_CSTDFN 4 /* constant */
#define BVL_BITDFN 8 /* bit type */
#define BVL_MUXDFN 16 /* mux_bit type */
#define BVL_WORDFN 24 /* wor_bit type */
#define BVL_RBIDFN 32 /* reg_bit type */
#define BVL_BTVDFN 40 /* bit_vector type */
#define BVL_MXVDFN 48 /* mux_vector type */
#define BVL_WRVDFN 56 /* wor_vector type */
#define BVL_RGVDFN 64 /* reg_vector type */
#define BVL_NATDFN 88 /* natural type */
#define BVL_NTVDFN 96 /* nat_vector type */
#define BVL_NORDFN 128 /* non guarded signal */
#define BVL_BUSDFN 256 /* guarded signal (bus) */
#define BVL_REGDFN 384 /* guarded signal (register)*/
#define BVL_MODDFN 0 /* field # 0 of dictionnary */
#define BVL_SIGDFN 1 /* field # 1 of dictionnary */
#define BVL_STBDFN 3 /* field # 3 of dictionnary */
#define BVL_LBLDFN 4 /* field # 4 of dictionnary */
#define BVL_WMXDFN 5 /* field # 5 of dictionnary */
#define BVL_WMNDFN 6 /* field # 6 of dictionnary */
#define BVL_PNTDFN 7 /* field # 7 of dictionnary */
#define BVL_UPTDFN 1 /* direction is up */
#define BVL_DWTDFN 0 /* direction is down */
/* ###---------------------------------------------------------------### */
#define NE 9
#define EQ 10
#define NOPI 11
#define NOPS 12
#define ANDM 13
#define CONC 14
#define CONVRT 15
#define BVL_UNGDFN 0
#define BVL_GRDDFN 1
/* ###---------------------------------------------------------------### */
/* #define BVL_INTDFN 0 */ /* int_val field of dtc_recrd */

View File

@ -0,0 +1,16 @@
/* ###--------------------------------------------------------------### */
/* */
/* file : bvl_blex.h */
/* date : Oct 4 1992 */
/* version : v108 */
/* author : TABUSSE L.A. */
/* content : declaration of functions and global variables used by */
/* lex */
/* */
/* ###--------------------------------------------------------------### */
extern int BVL_LINNUM; /* file's line number */
static char buffer [1024];
static int search ();

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
/* ###--------------------------------------------------------------### */
/* */
/* file : bvl_bspec.h */
/* date : Jun 15 1992 */
/* author : TABUSSE L.A. */
/* content : declaration of functions and global variables used by */
/* bvl_bspec.c */
/* */
/* ###--------------------------------------------------------------### */
extern bvl_ablstr BVL_EMPSTR;
extern chain_list *bddToAbl () ;
struct begen *bvl_addgen ();
struct chain *bvl_cpyabllst ();
bvl_ablstr bvl_cpyablstr ();
bvl_ablstr bvl_crtabl ();
void bvl_select ();

View File

@ -0,0 +1,68 @@
/* ###--------------------------------------------------------------### */
/* */
/* file : bvl_byacc.h */
/* date : Oct 4 1993 */
/* version : v108 */
/* author : Pirouz BAZARGAN SABET */
/* content : declaration of external functions and global variables*/
/* used by yacc */
/* */
/* ###--------------------------------------------------------------### */
typedef struct bvl_expr
{
char *IDENT; /* identifier or constant name */
struct chain *LIST_ABL; /* pointer on bvl_abllst list */
short WIDTH; /* width of bit vector */
}
bvl_ablstr;
typedef struct
{
char *NAME; /* identifier name */
short LEFT; /* vector's left index */
short RIGHT; /* vector's right index */
char FLAG; /* scalar ('S') or array 'A' */
}
bvl_name;
struct g_type
{
int VALU;
char FLAG;
};
pNode BVL_BDDPNT; /* BDD pointer */
char *BVL_MODNAM; /* curnennt model name */
bvl_ablstr BVL_SLCEXP; /* structure filled with the */
bvl_ablstr BVL_EMPSTR; /* empty structure used with NOT*/
extern int BVL_AUXMOD; /* simplify internal sig (= 1) */
static char *BVL_LBLNAM = NULL; /* label */
static struct chain *BVL_NM1LST = NULL; /* 1-st name liste */
static struct chain *BVL_GRDLST = NULL; /* list of guard's ABL */
static struct chain *BVL_CNDLST = NULL; /* list of conditions (ABL) */
static struct chain *BVL_VALLST = NULL; /* list of waveforms (ABL) */
static struct befig *BVL_BEFPNT = NULL; /* current BEFIG pointer */
static struct beden **dic = NULL; /* dictionary */
struct chain *BVL_INTLST = NULL;
struct begen *BVL_GENPNT = NULL;
extern char BVL_ERRFLG; /* set to 1 in case of error */
extern struct befig *BVL_HEDFIG; /* head of befigs */
extern struct begen *bvl_addgen();
extern bvl_ablstr bvl_crtabl();
extern bvl_ablstr bvl_cpyablstr();
extern void bvl_select();
extern void bvl_error();
extern void *addstr ();
static struct dct_entry **initab ();
static void addtab ();
static int chktab ();
static void fretab ();

View File

@ -0,0 +1,484 @@
/* ###--------------------------------------------------------------### */
/* */
/* file : bvl_drive.c */
/* date : May 31 1994 */
/* version : v109 */
/* author : VUONG H.N. */
/* description : This file contains VHDL drivers : */
/* vhdlsavebefig() */
/* */
/* ###--------------------------------------------------------------### */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "mut.h"
#include "beh.h"
#include "log.h"
#include "bvl_utype.h"
#include "bvl_utdef.h"
#include "bvl_drive.h"
/* ###--------------------------------------------------------------### */
/* function : vhdlsavebefig */
/* description : print out a text file containing a data-flow VHDL */
/* description */
/* called func. : bvl_vhdlname, mbkalloc, beh_message, beh_error , */
/* beh_toolbug , getptype, reverse , bvl_abl2str */
/* */
/* ###--------------------------------------------------------------### */
void vhdlsavebefig (pthedbefig, trace_mode)
struct befig *pthedbefig;
int trace_mode;
{
char *suffix;
char *str;
char *mode;
char *type_mark;
int nrlabel = 0;
int buff_size = 100;
char *buffer;
FILE *fd;
time_t clock;
int left,right;
char *name;
char *bus;
struct begen *ptgeneric = NULL; /* current ptype pnt (generic) */
struct bereg *ptbereg = NULL; /* current BEREG pointer */
struct bemsg *ptbemsg = NULL; /* current BEMSG pointer */
struct beout *ptbeout = NULL; /* current BEOUT pointer */
struct bebus *ptbebus = NULL; /* current BEBUS pointer */
struct beaux *ptbeaux = NULL; /* current BEAUX pointer */
struct bebux *ptbebux = NULL; /* current BEBUX pointer */
struct bepor *ptbepor = NULL; /* correctly ordered port list */
struct biabl *ptbiabl = NULL; /* current BIABL pointer */
if (pthedbefig == NULL)
beh_toolbug (10,"bvl_decomp",NULL,0);
buffer = mbkalloc (buff_size);
buffer[0] = '\0';
if ((str = getenv ("VH_BEHSFX")) != NULL)
suffix = strtok (str, ":");
else
suffix = "vbe";
/* ###------------------------------------------------------### */
/* Opening result file */
/* ###------------------------------------------------------### */
if ((fd = mbkfopen (pthedbefig->NAME, suffix, WRITE_TEXT)) == NULL)
{
beh_error (107, NULL);
EXIT (1);
}
if (trace_mode == 1)
beh_message (13, pthedbefig->NAME);
time (&clock);
(void) fprintf (fd,"-- VHDL data flow description generated from `%s`\n",
pthedbefig->NAME);
(void) fprintf (fd, "--\t\tdate : %s\n\n", ctime(&clock));
/* ###------------------------------------------------------### */
/* Entity declaration */
/* ###------------------------------------------------------### */
(void) fprintf (fd,"-- Entity Declaration\n\n");
(void) fprintf (fd,"ENTITY %s IS\n",bvl_vhdlname(pthedbefig->NAME));
/* ###------------------------------------------------------### */
/* Generic declaration */
/* ###------------------------------------------------------### */
if ((ptgeneric = pthedbefig->BEGEN) != NULL)
{
ptgeneric = (struct begen *) reverse ((chain_list*) ptgeneric);
(void) fprintf (fd," GENERIC (\n");
while (ptgeneric != NULL)
{
(void)fprintf (fd," CONSTANT %s : NATURAL := %ld",
bvl_vhdlname(ptgeneric->NAME),*((long *)ptgeneric->VALUE));
if (ptgeneric->NEXT != NULL)
(void)fprintf(fd,";\t-- %s\n",(char *)ptgeneric->NAME);
else
(void)fprintf(fd,"\t-- %s\n",(char *)ptgeneric->NAME);
ptgeneric = ptgeneric->NEXT;
}
(void) fprintf (fd," );\n");
}
/* ###------------------------------------------------------### */
/* Port declaration */
/* ###------------------------------------------------------### */
ptbepor = pthedbefig->BEPOR;
if (ptbepor != NULL)
{
(void) fprintf (fd," PORT (\n");
pthedbefig->BEPOR = (struct bepor *)reverse ((chain_list*) pthedbefig->BEPOR);
ptbepor = pthedbefig->BEPOR;
while (ptbepor != NULL)
{
switch (ptbepor->DIRECTION)
{
case 'I':
mode = namealloc("IN");
break;
case 'O':
case 'Z':
mode = namealloc("OUT");
break;
case 'B':
case 'T':
mode = namealloc("INOUT");
break;
default :
beh_error (69, ptbepor->NAME);
}
ptbepor = (bepor_list *) bvl_vectnam (ptbepor,&left,&right,&name,0);
if(left != -1)
{
switch (ptbepor->TYPE)
{
case 'B':
type_mark = namealloc("BIT_VECTOR");
bus = "";
break;
case 'W':
type_mark = namealloc("WOR_VECTOR");
bus = namealloc("BUS");
break;
case 'M':
type_mark = namealloc("MUX_VECTOR");
bus = namealloc("BUS");
break;
default :
beh_error (68, ptbepor->NAME);
}
(void)fprintf(fd," %s : %s %s(%d %s %d) %s",bvl_vhdlname(name), mode,
type_mark, left, (left>=right)?"DOWNTO":"TO",right,bus);
}
else
{
switch (ptbepor->TYPE)
{
case 'B':
type_mark = "BIT"; break;
case 'W':
type_mark = "WOR_BIT BUS"; break;
case 'M':
type_mark = "MUX_BIT BUS"; break;
default :
beh_error (68, ptbepor->NAME);
}
(void) fprintf (fd," %s : %s %s",bvl_vhdlname(name),
mode,type_mark);
}
if (ptbepor->NEXT != NULL)
(void) fprintf (fd,";\t-- %s\n",name);
else
(void) fprintf (fd,"\t-- %s\n );\n",name);
ptbepor = ptbepor->NEXT;
}
pthedbefig->BEPOR = (struct bepor *)reverse ((chain_list*) pthedbefig->BEPOR);
}
(void) fprintf (fd,"END %s;\n\n\n",bvl_vhdlname(pthedbefig->NAME));
/* ###------------------------------------------------------### */
/* Architecture declaration */
/* ###------------------------------------------------------### */
(void) fprintf (fd,"-- Architecture Declaration\n\n");
(void) fprintf (fd,"ARCHITECTURE behaviour_data_flow OF %s IS\n",
bvl_vhdlname(pthedbefig->NAME));
/* ###------------------------------------------------------### */
/* Treatment of the BEREG list */
/* ###------------------------------------------------------### */
pthedbefig->BEREG = (struct bereg *)reverse((chain_list*) pthedbefig->BEREG);
ptbereg = pthedbefig->BEREG;
while (ptbereg != NULL)
{
ptbereg = (bereg_list *)bvl_vectnam(ptbereg,&left,&right,&name,2);
if(left != -1)
{
(void)fprintf(fd," SIGNAL %s : REG_VECTOR(%d %s %d) REGISTER;\t-- %s\n",
bvl_vhdlname(name),left,(left>=right)?"DOWNTO":"TO",
right,name);
}
else
{
(void) fprintf (fd," SIGNAL %s : REG_BIT REGISTER;\t-- %s\n",
bvl_vhdlname(name),name);
}
ptbereg = ptbereg->NEXT;
}
pthedbefig->BEREG = (struct bereg *)reverse((chain_list*) pthedbefig->BEREG);
/* ###------------------------------------------------------### */
/* Treatment of the BEBUX list */
/* ###------------------------------------------------------### */
pthedbefig->BEBUX = (struct bebux *)reverse((chain_list*) pthedbefig->BEBUX);
ptbebux = pthedbefig->BEBUX;
while (ptbebux != NULL)
{
ptbebux = (bebux_list *)bvl_vectnam(ptbebux,&left,&right,&name,1);
if(left != -1)
{
switch (ptbebux->TYPE)
{
case 'W':
type_mark = namealloc("WOR_VECTOR");
break;
case 'M':
type_mark = namealloc("MUX_VECTOR");
break;
}
(void)fprintf(fd," SIGNAL %s : %s(%d %s %d) BUS;\t-- %s\n",
bvl_vhdlname(name),type_mark,left,(left>=right)?"DOWNTO":"TO",
right,name);
}
else
{
switch (ptbebux->TYPE)
{
case 'W':
type_mark = namealloc("WOR_BIT");
break;
case 'M':
type_mark = namealloc("MUX_BIT");
break;
}
(void) fprintf (fd," SIGNAL %s : %s BUS;\t\t-- %s\n",bvl_vhdlname(name),
type_mark,name);
}
ptbebux = ptbebux->NEXT;
}
pthedbefig->BEBUX = (struct bebux *)reverse((chain_list*) pthedbefig->BEBUX);
pthedbefig->BEAUX = (struct beaux *)reverse((chain_list*) pthedbefig->BEAUX);
ptbeaux = pthedbefig->BEAUX;
while (ptbeaux != NULL)
{
ptbeaux = (beaux_list *)bvl_vectnam(ptbeaux,&left,&right,&name,3);
if(left != -1)
{
(void)fprintf(fd," SIGNAL %s : BIT_VECTOR(%d %s %d);\t-- %s\n",
bvl_vhdlname(name),left,(left>=right)?"DOWNTO":"TO",
right,name);
}
else
{
(void) fprintf (fd," SIGNAL %s : BIT;\t\t-- %s\n",
bvl_vhdlname(name),name);
}
ptbeaux = ptbeaux->NEXT;
}
pthedbefig->BEAUX = (struct beaux *)reverse((chain_list*) pthedbefig->BEAUX);
(void) fprintf (fd,"\nBEGIN\n");
/* ###------------------------------------------------------### */
/* Print out a concurrent assert statement for each BEMSG */
/* ###------------------------------------------------------### */
ptbemsg = pthedbefig->BEMSG;
while (ptbemsg != NULL)
{
if (ptbemsg->LABEL != NULL)
(void)fprintf(fd," %s :", ptbemsg->LABEL);
buffer = bvl_abl2str (ptbemsg->ABL,buffer,&buff_size);
(void) fprintf (fd," ASSERT (%s = '1')\n", bvl_printabl(buffer));
buffer[0] = '\0';
if (ptbemsg->MESSAGE != NULL)
(void) fprintf (fd," REPORT %s\n",ptbemsg->MESSAGE);
if (ptbemsg->LEVEL == 'W')
(void) fprintf (fd," SEVERITY WARNING;");
else
(void) fprintf (fd," SEVERITY ERROR;");
(void) fprintf (fd,"\n\n");
ptbemsg = ptbemsg->NEXT;
}
/* ###------------------------------------------------------### */
/* Print out a concurrent signal assignment for each BEAUX */
/* ###------------------------------------------------------### */
ptbeaux = pthedbefig->BEAUX;
while (ptbeaux != NULL)
{
if (ptbeaux->ABL != NULL)
{
buffer = bvl_abl2str (ptbeaux->ABL,buffer,&buff_size);
(void) fprintf (fd," %s <= %s;\n",bvl_vectorize(ptbeaux->NAME),bvl_printabl(buffer));
buffer[0] = '\0';
}
else
beh_error (40, ptbeaux->NAME);
ptbeaux = ptbeaux->NEXT;
}
/* ###------------------------------------------------------### */
/* Print out a block statement with one guarded concurrent */
/* signal assignment for each BIABL of each BEREG */
/* ###------------------------------------------------------### */
ptbereg = pthedbefig->BEREG;
while (ptbereg != NULL)
{
ptbiabl = ptbereg->BIABL;
while (ptbiabl != NULL)
{
(void) fprintf (fd," label%d : BLOCK ",nrlabel);
if (ptbiabl->CNDABL != NULL)
{
buffer = bvl_abl2str (ptbiabl->CNDABL,buffer,&buff_size);
(void) fprintf (fd,"(%s = '1')\n",bvl_printabl(buffer));
buffer[0] = '\0';
}
else
beh_toolbug (19,"bvl_decomp",ptbereg->NAME,0);
(void) fprintf (fd," BEGIN\n %s <= GUARDED ",bvl_vectorize(ptbereg->NAME));
if (ptbiabl->VALABL != NULL)
{
buffer = bvl_abl2str (ptbiabl->VALABL,buffer,&buff_size);
(void) fprintf (fd,"%s;\n",bvl_printabl(buffer));
buffer[0] = '\0';
}
else
beh_toolbug (20,"bvl_decomp",ptbereg->NAME,0);
(void) fprintf ( fd," END BLOCK label%d;\n",nrlabel);
ptbiabl = ptbiabl->NEXT;
nrlabel++;
}
ptbereg = ptbereg->NEXT;
}
/* ###------------------------------------------------------### */
/* Print out a block statement with one guarded concurrent */
/* signal assignment for each BIABL of each BEBUX */
/* ###------------------------------------------------------### */
ptbebux = pthedbefig->BEBUX;
while (ptbebux != NULL)
{
ptbiabl = ptbebux->BIABL;
while (ptbiabl != NULL)
{
(void) fprintf (fd," label%d : BLOCK (",nrlabel);
if (ptbiabl->CNDABL != NULL)
{
buffer = bvl_abl2str (ptbiabl->CNDABL,buffer,&buff_size);
(void) fprintf (fd,"%s = '1')\n",bvl_printabl(buffer));
buffer[0] = '\0';
}
else
beh_toolbug (19,"bvl_decomp",ptbebux->NAME,0);
(void) fprintf (fd," BEGIN\n %s <= GUARDED ",
bvl_vectorize(ptbebux->NAME));
if (ptbiabl->VALABL != NULL)
{
buffer = bvl_abl2str (ptbiabl->VALABL,buffer,&buff_size);
(void) fprintf (fd,"%s;\n",bvl_printabl(buffer));
buffer[0] = '\0';
}
else
beh_toolbug (20,"bvl_decomp",ptbebux->NAME,0);
(void) fprintf (fd," END BLOCK label%d;\n",nrlabel);
ptbiabl = ptbiabl->NEXT;
nrlabel++;
}
ptbebux = ptbebux->NEXT;
}
/* ###------------------------------------------------------### */
/* Print out a block statement with one guarded concurrent */
/* signal assignment for each BIABL of each BEBUS */
/* ###------------------------------------------------------### */
ptbebus = pthedbefig->BEBUS;
while (ptbebus != NULL)
{
ptbiabl = ptbebus->BIABL;
while (ptbiabl != NULL)
{
(void) fprintf (fd,"\tlabel%d : BLOCK (",nrlabel);
if (ptbiabl->CNDABL != NULL)
{
buffer = bvl_abl2str (ptbiabl->CNDABL,buffer,&buff_size);
(void) fprintf (fd,"%s = '1')\n",bvl_printabl(buffer));
buffer[0] = '\0';
}
else
beh_toolbug (19,"bvl_decomp",ptbebus->NAME,0);
(void) fprintf (fd,"\tBEGIN\n\t%s <= GUARDED ",bvl_vectorize(ptbebus->NAME));
if (ptbiabl->VALABL != NULL)
{
buffer = bvl_abl2str (ptbiabl->VALABL,buffer,&buff_size);
(void) fprintf (fd,"%s;\n",bvl_printabl(buffer));
buffer[0] = '\0';
}
else
beh_toolbug (20,"bvl_decomp",ptbebus->NAME,0);
(void) fprintf (fd,"\tEND BLOCK label%d;\n",nrlabel);
ptbiabl = ptbiabl->NEXT;
nrlabel++;
}
ptbebus = ptbebus->NEXT;
}
/* ###------------------------------------------------------### */
/* Print out a concurrent signal assignment for each BEOUT */
/* ###------------------------------------------------------### */
ptbeout = pthedbefig->BEOUT;
while (ptbeout != NULL)
{
if (ptbeout->ABL != NULL)
{
buffer = bvl_abl2str(ptbeout->ABL,buffer,&buff_size);
(void) fprintf (fd,"\n%s <= %s;\n",bvl_vectorize(ptbeout->NAME), bvl_printabl(buffer));
buffer[0] = '\0';
}
else
beh_error (40, ptbeout->NAME);
ptbeout = ptbeout->NEXT;
}
(void) fprintf (fd,"END;\n");
(void) fclose (fd);
}

View File

@ -0,0 +1,18 @@
/* ###--------------------------------------------------------------### */
/* */
/* file : bvl_drive.h */
/* date : may 31 1994 */
/* version : v109 */
/* author : VUONG H.N. */
/* content : declaration of functions and global variables used by */
/* the behavioural decompiler */
/* */
/* ###--------------------------------------------------------------### */
extern char *bvl_vhdlname();
extern char *bvl_abl2str();
extern char *bvl_printabl();
extern void bvl_message();
extern char *bvl_vectorize ();
extern void *bvl_vectnam ();

View File

@ -0,0 +1,101 @@
/* ###--------------------------------------------------------------### */
/* */
/* file : bvl_parse.c */
/* date : jun 15 1994 */
/* version : v109 */
/* author : L.A TABUSSE & H.N. VUONG & P. BAZARGAN-SABET */
/* description : Parser VHDL --> BEH */
/* called Func. : mbkalloc */
/* */
/* ###--------------------------------------------------------------### */
#include <stdio.h>
#include <string.h>
#include "mut.h"
#include "beh.h"
#include "bvl_utype.h"
#include "bvl_utdef.h"
#include "bvl_parse.h"
/* ###--------------------------------------------------------------### */
/* Function : vhdlloadbefig */
/* Content : Parse a .vbe file to produce a befig */
/* Return : a pointer on a befig */
/* ###--------------------------------------------------------------### */
struct befig *vhdlloadbefig (pt_befig, figname, trace_mode)
struct befig *pt_befig;
char *figname;
int trace_mode;
{
char *tok;
char *str;
struct chain *behsfx_lst = NULL;
struct chain *suffix = NULL;
static unsigned int call_nbr = 0;
/* ###------------------------------------------------------### */
/* Create list of suffix for behavioural files from the */
/* environment variable VH_BEHSFX */
/* ###------------------------------------------------------### */
if ((str = getenv ("VH_BEHSFX")) != NULL)
{
tok = strtok (str, ":");
while (tok != NULL)
{
behsfx_lst = addchain (behsfx_lst, tok);
tok = strtok (NULL, ":");
}
behsfx_lst = (struct chain *) reverse (behsfx_lst);
}
else
behsfx_lst = addchain (NULL, "vbe");
/* ###------------------------------------------------------### */
/* Searching the root file */
/* ###------------------------------------------------------### */
suffix = behsfx_lst;
while (suffix != NULL)
{
if ((bvl_y_in = mbkfopen (figname, suffix->DATA, READ_TEXT)) != NULL)
{
sprintf (BVL_CURFIL, "%s.%s", figname, (char *)suffix->DATA);
break;
}
suffix = suffix->NEXT;
}
if (bvl_y_in == NULL)
{
beh_error (100, figname);
EXIT (1);
}
/* ###------------------------------------------------------### */
/* Running the behavioural compiler on the current file */
/* ###------------------------------------------------------### */
if ((trace_mode & BVL_TRCDFN) != 0)
beh_message (3, BVL_CURFIL);
if ((trace_mode & BVL_AUXDFN) == 0)
BVL_AUXMOD = 0;
else
BVL_AUXMOD = 1;
BVL_LINNUM = 1;
if (call_nbr != 0)
bvl_y_restart (bvl_y_in);
call_nbr++;
bvl_y_parse ();
fclose (bvl_y_in);
bvl_y_in = NULL;
return (BVL_HEDFIG);
}

View File

@ -0,0 +1,23 @@
/* ###--------------------------------------------------------------### */
/* */
/* file : bvl_parse.h */
/* date : May 31 1994 */
/* version : v109 */
/* author : L.A. TABUSSE & H.G. VUONG & P. BAZARGAN-SABET */
/* description : */
/* */
/* ###--------------------------------------------------------------### */
#define BVL_TRCDFN 0x00000001
#define BVL_AUXDFN 0x00000002
char BVL_ERRFLG = 0; /* if = 1 no structure is made */
int BVL_LINNUM = 1; /* file's line number */
int BVL_AUXMOD; /* simplify internal sig (= 1) */
char BVL_CURFIL[200]; /* current file's name */
befig_list *BVL_HEDFIG = NULL;
extern FILE *bvl_y_in;
extern int bvl_y_parse();
extern char *getenv();

View File

@ -0,0 +1,38 @@
/* ###--------------------------------------------------------------### */
/* */
/* file : bvl_utdef.h */
/* date : Jun 18 1992 */
/* version : v103 */
/* author : L.A.TABUSSE */
/* content : declaration of external functions and global variables*/
/* used by yacc */
/* */
/* ###--------------------------------------------------------------### */
#define BVL_ICNDFN 1 /* input port */
#define BVL_OCNDFN 2 /* output port */
#define BVL_BCNDFN 3 /* inout port */
#define BVL_BITDFN 8 /* bit type */
#define BVL_MUXDFN 16 /* mux_bit type */
#define BVL_WORDFN 24 /* wor_bit type */
#define BVL_RBIDFN 32 /* reg_bit type */
#define BVL_NORDFN 128 /* non guarded signal */
#define BVL_BUSDFN 256 /* guarded signal (bus) */
#define BVL_REGDFN 384 /* guarded signal (register)*/
#define BVL_NAMDFN 0
#define BVL_NEWDFN 1
#define BVL_MODDFN 0 /* mod_val field of dct_recrd */
#define BVL_SIGDFN 1 /* sig_val field of dct_recrd */
#define BVL_CCNDFN 2 /* ccn_val field of dct_recrd */
#define BVL_RNGDFN 3 /* rng_val field of dct_recrd */
#define BVL_LBLDFN 4 /* lbl_val field of dct_recrd */
#define BVL_WMXDFN 5 /* wmx_val field of dct_recrd */
#define BVL_WMNDFN 6 /* wmn_val field of dct_recrd */
#define BVL_PNTDFN 7 /* pnt_val field of dct_recrd */
#define BVL_MXRDFN 30

View File

@ -0,0 +1,663 @@
/* ###--------------------------------------------------------------### */
/* */
/* file : bvl_util.c */
/* date : Jan 18 1993 */
/* version : v106 */
/* author : Pirouz BAZARGAN SABET */
/* description : This file contains some utility functions : */
/* bvl_error , bvl_y_error */
/* */
/* ###--------------------------------------------------------------### */
#include <stdio.h>
#include <string.h>
#include "mut.h"
#include "beh.h"
#include "log.h"
#include "bvl_utype.h"
#include "bvl_util.h"
#include "bvl_utdef.h"
/* ###--------------------------------------------------------------### */
/* function : bvl_error */
/* ###--------------------------------------------------------------### */
void bvl_error (code, str1)
int code;
char *str1;
{
BVL_ERRFLG++;
(void)fprintf (stderr,"`%s` Error %d line %d :",BVL_CURFIL,code,BVL_LINNUM);
switch (code)
{
case 1:
(void) fprintf (stderr,"`%s` is incompatible with the entity name\n",str1);
break;
case 2:
(void) fprintf (stderr,"bad entity declaration\n");
break;
case 3:
(void) fprintf (stderr,"bad port clause declaration\n");
break;
case 4:
(void) fprintf (stderr,"port `%s` already declared\n",str1);
break;
case 5:
(void) fprintf (stderr,"illegal port declaration (mode, type, kind)\n");
break;
case 6:
(void) fprintf (stderr,"bad port declaration\n");
break;
case 7:
(void) fprintf (stderr,"`%s` is incompatible with the architecture name\n",str1);
break;
case 8:
(void) fprintf (stderr,"bad architecture declaration\n");
break;
case 9:
(void) fprintf (stderr,"illegal declaration\n");
break;
case 10:
(void) fprintf (stderr,"signal `%s` already declared\n",str1);
break;
case 11:
(void) fprintf (stderr,"illegal signal declaration (type, kind)\n");
break;
case 17:
(void) fprintf (stderr,"`%s` unknown port or signal\n",str1);
break;
case 18:
(void) fprintf (stderr,"illegal concurrent statement\n");
break;
case 19:
(void) fprintf (stderr,"label `%s` already used\n",str1);
break;
case 20:
(void) fprintf (stderr,"`%s` is incompatible with the block's label\n",str1);
break;
case 21:
(void) fprintf (stderr,"input port `%s` cannot be assigned\n",str1);
break;
case 22:
(void) fprintf (stderr,"unguarded signal `%s` assigned by guarded assignment\n",str1);
break;
case 23:
(void) fprintf (stderr,"guarded signal `%s` assigned by unguarded assignment\n",str1);
break;
case 25:
(void) fprintf (stderr,"some choices missing in the selected signal assignment\n");
break;
case 26:
(void) fprintf (stderr,"output port `%s` cannot be read\n",str1);
break;
case 28:
(void) fprintf (stderr,"duplicate choice in selected signal assignment\n");
break;
case 30:
(void) fprintf (stderr,"illegal use of OTHERS in selected signal assignment\n");
break;
case 32:
(void) fprintf (stderr,"null array not supported\n");
break;
case 33:
(void) fprintf (stderr,"incompatible constraint and type\n");
break;
case 35:
(void) fprintf (stderr,"illegal assignment of `%s` (widths mismatch)\n",str1);
break;
case 36:
(void) fprintf (stderr,"signal `%s` used out of declared range\n",str1);
break;
case 38:
(void) fprintf (stderr,"width or/and type mismatch\n");
break;
case 39:
(void) fprintf (stderr,"signal `%s` assigned more than once\n",str1);
break;
case 40:
(void) fprintf (stderr,"signal `%s` never assigned\n",str1);
break;
case 68:
(void) fprintf (stderr,"BEPOR type is unknown\n");
break;
case 73:
(void) fprintf (stderr,"`%s` is not a bit string litteral\n",str1);
break;
case 74:
(void) fprintf (stderr,"bad generic declaration\n");
break;
case 75:
(void) fprintf (stderr,"bad generic element\n");
break;
case 76:
(void) fprintf (stderr,"`%s`: when expression must be a constant\n",str1);
break;
case 77:
(void) fprintf (stderr,"illegal generic declaration (type, kind)\n");
break;
case 78:
(void) fprintf (stderr,"illegal constant declaration (type, kind)\n");
break;
case 79:
(void) fprintf (stderr,"illegal use of attribute STABLE on `%s`\n",str1);
break;
default:
(void) fprintf (stderr,"syntax error\n");
break;
}
if (BVL_ERRFLG > BVL_MXRDFN)
{
(void) fprintf (stderr,"Too many errors. Cannot continue further more\n");
(void) fprintf (stderr,"\n Have a nice day...\n");
exit (1);
}
}
/* ###--------------------------------------------------------------### */
/* function : bvl_y_error */
/* ###--------------------------------------------------------------### */
void bvl_y_error (str)
char *str;
{
BVL_ERRFLG++;
(void)fprintf (stderr,"`%s` Error line %d : %s\n",BVL_CURFIL,BVL_LINNUM,str);
}
/* ###--------------------------------------------------------------### */
/* function : bvl_vhdlname */
/* ###--------------------------------------------------------------### */
char *bvl_vhdlname (name)
char *name;
{
char *new_name;
char *prv_name;
char *tmp_name;
char buffer[200];
int i,j,flag,number;
static struct beden **namtab=NULL;
static char *keywrd [] = {
"abs" , "access" ,
"after" , "alias" ,
"all" , "and" ,
"architecture", "array" ,
"assert" , "attribute" ,
"begin" , "bit" ,
"bit_vector" , "block" ,
"body" , "buffer" ,
"bus" , "case" ,
"component" , "configuration",
"constant" , "disconnect" ,
"downto" , "else" ,
"elsif" , "end" ,
"entity" , "error" ,
"exit" , "file" ,
"for" , "function" ,
"generate" , "generic" ,
"guarded" , "if" ,
"in" , "inout" ,
"is" , "label" ,
"library" , "linkage" ,
"loop" , "map" ,
"mod" , "mux_bit" ,
"mux_vector" , "nand" ,
"natural" , "new" ,
"next" , "nor" ,
"not" , "null" ,
"of" , "on" ,
"open" , "or" ,
"others" , "out" ,
"package" , "port" ,
"procedure" , "process" ,
"range" , "record" ,
"reg_bit" , "reg_vector" ,
"register" , "rem" ,
"report" , "return" ,
"select" , "severity" ,
"signal" , "stable" ,
"subtype" , "then" ,
"to" , "transport" ,
"type" , "units" ,
"until" , "use" ,
"variable" , "wait" ,
"warning" , "when" ,
"while" , "with" ,
"wor_bit" , "wor_vector" ,
"xor"
};
if (namtab == NULL)
{
namtab = beh_initab ();
for (i=0 ; i<93 ; i++)
beh_addtab (namtab, namealloc (keywrd [i]), NULL, BVL_NEWDFN , 1);
}
tmp_name = namealloc (name);
new_name = (char *) beh_chktab (namtab,tmp_name,NULL,BVL_PNTDFN);
if (beh_chktab (namtab,tmp_name,NULL,BVL_NAMDFN) == 0)
{
i = 0;
j = 0;
number = 0;
flag = 1;
while (tmp_name[i] != '\0')
{
buffer[j] = tmp_name[i];
if ( ((tmp_name[i] >= 'a') && (tmp_name[i] <= 'z')) ||
((tmp_name[i] >= 'A') && (tmp_name[i] <= 'Z')) ||
((tmp_name[i] >= '0') && (tmp_name[i] <= '9') && (i != 0)))
flag = 0;
else
{
if (flag == 1)
buffer[j++] = 'v';
buffer[j] = '_';
flag = 1;
}
i++;
j++;
}
if (buffer[j-1] == '_')
buffer[j++] = '0';
buffer[j] = '\0';
new_name = namealloc (buffer);
prv_name = new_name;
while (beh_chktab (namtab,new_name,NULL,BVL_NEWDFN) != 0)
{
new_name = prv_name;
sprintf (buffer,"%s_%d",new_name,number++);
prv_name = new_name;
new_name = namealloc (buffer);
}
beh_addtab (namtab,new_name,NULL,BVL_NEWDFN,1);
beh_addtab (namtab,tmp_name,NULL,BVL_PNTDFN,(long)new_name);
beh_addtab (namtab,tmp_name,NULL,BVL_NAMDFN,1);
}
return (new_name);
}
/* ###--------------------------------------------------------------### */
/* function : bvl_vectorize */
/* description : put parenthesis on element of bussed signals */
/* called func. : mbkalloc */
/* ###--------------------------------------------------------------### */
char *bvl_vectorize(name)
char *name;
{
char *new_name ;
char tmp1 [256];
int i = 0;
static struct beden **tab = NULL;
if (tab == NULL)
tab = beh_initab ();
if ((new_name = (char *) beh_chktab (tab, name, NULL, BVL_PNTDFN)) == NULL)
{
strcpy (tmp1, name);
while ((name [i] != '\0') && (name [i] != ' ' ) && (name [i] != '\''))
i ++;
tmp1 [i] = '\0';
new_name = bvl_vhdlname (tmp1);
if (name [i] != '\0')
{
if (name [i] == ' ')
sprintf (tmp1, "%s (%s)", new_name, &name[i+1]);
else
sprintf (tmp1, "%s'%s" , new_name, &name[i+1]);
new_name = namealloc (tmp1);
}
beh_addtab (tab, name, NULL, BVL_PNTDFN, new_name);
}
return (new_name);
}
/* ###--------------------------------------------------------------### */
/* function : bvl_vectnam */
/* analyze a list of signal and return the bounds of the vectorised */
/* signals, if they occure. */
/* ###--------------------------------------------------------------### */
void *bvl_vectnam(pt_list,left,right,name,type)
void *pt_list;
int *left, *right;
char **name;
char type; /* If type = 0 bepor_list, type = 1 bebux_list */
/* If type = 2 bereg_list, type = 3 beaux_list */
{
char *blank_space;
char *sig_name;
char name_tmp[200];
char number[200];
bepor_list *ptpor;
bebux_list *ptbux;
beaux_list *ptaux;
bereg_list *ptreg;
char END = 0;
char *mode;
/* Case bepor_list */
if(type==0)
{
ptpor = (bepor_list *)pt_list;
*left = *right = -1;
sig_name = ptpor->NAME;
*name = (char*)mbkalloc(strlen(sig_name) + 1);
strcpy(*name,sig_name);
blank_space = strchr(*name,' ');
if (blank_space != NULL)
{
strcpy(number,blank_space);
*left = atoi(number);
*right = *left;
*blank_space = '\0';
}
while(!END)
{
if(ptpor->NEXT != NULL)
{
strcpy(name_tmp,(ptpor->NEXT)->NAME);
blank_space = strchr(name_tmp,' ');
if(blank_space!=NULL)
{
strcpy(number,blank_space);
*blank_space = '\0';
if(!strcmp(*name,name_tmp))
{
*right = atoi(number);
ptpor = ptpor->NEXT;
}
else
END = 1;
}
else
END = 1;
}
else
END = 1;
}
return(ptpor);
}
/*case bebux_list */
if(type==1)
{
ptbux = (bebux_list *)pt_list;
/* Extract the name and number of an element */
*left = *right = -1;
sig_name = ptbux->NAME;
*name = (char *)mbkalloc(strlen(sig_name) + 1);
strcpy(*name,sig_name);
blank_space = strchr(*name,' ');
if (blank_space != NULL)
{
strcpy(number,blank_space);
*right = atoi(number);
*left = *right;
*blank_space = '\0';
}
while(END != 1)
{
if(ptbux->NEXT != NULL)
{
strcpy(name_tmp,ptbux->NEXT->NAME);
blank_space = strchr(name_tmp,' ');
if(blank_space!=NULL)
{
strcpy(number,blank_space);
*blank_space = '\0';
if(!strcmp(*name,name_tmp))
{
*right = atoi(number);
ptbux = ptbux->NEXT;
}
else
END = 1;
}
else
END = 1;
}
else
END = 1;
}
return(ptbux);
}
/*case bereg_list */
if(type==2)
{
ptreg = (bereg_list *)pt_list;
/* Extract the name and number of an element */
*left = *right = -1;
sig_name = ptreg->NAME;
*name = (char *)mbkalloc(strlen(sig_name) + 1);
strcpy(*name,sig_name);
blank_space = strchr(*name,' ');
if (blank_space != NULL)
{
strcpy(number,blank_space);
*right = atoi(number);
*left = *right;
*blank_space = '\0';
}
while(END != 1)
{
if(ptreg->NEXT != NULL)
{
strcpy(name_tmp,ptreg->NEXT->NAME);
blank_space = strchr(name_tmp,' ');
if(blank_space!=NULL)
{
strcpy(number,blank_space);
*blank_space = '\0';
if(!strcmp(*name,name_tmp))
{
*right = atoi(number);
ptreg = ptreg->NEXT;
}
else
END = 1;
}
else
END = 1;
}
else
END = 1;
}
return(ptreg);
}
/*case beaux_list */
if(type==3)
{
ptaux = (beaux_list *)pt_list;
/* Extract the name and number of an element */
*left = *right = -1;
sig_name = ptaux->NAME;
*name = (char *)mbkalloc(strlen(sig_name) + 1);
strcpy(*name,sig_name);
blank_space = strchr(*name,' ');
if (blank_space != NULL)
{
strcpy(number,blank_space);
*right = atoi(number);
*left = *right;
*blank_space = '\0';
}
while(END != 1)
{
if(ptaux->NEXT != NULL)
{
strcpy(name_tmp,ptaux->NEXT->NAME);
blank_space = strchr(name_tmp,' ');
if(blank_space!=NULL)
{
strcpy(number,blank_space);
*blank_space = '\0';
if(!strcmp(*name,name_tmp))
{
*right = atoi(number);
ptaux = ptaux->NEXT;
}
else
END = 1;
}
else
END = 1;
}
else
END = 1;
}
return(ptaux);
}
}
/* ###--------------------------------------------------------------### */
/* function : bvl_printabl */
/* content : put a \n for a better presentation of an abl */
/* ###--------------------------------------------------------------### */
char *bvl_printabl(chaine)
char *chaine;
{
char *chaine_tmp = NULL;
char *blanc = NULL;
chaine_tmp = chaine;
while(strlen(chaine_tmp)>60)
{
chaine_tmp = &chaine_tmp[60];
blanc = strchr(chaine_tmp,' ');
if(blanc != NULL)
{
*blanc = '\n';
chaine_tmp = blanc;
}
}
return(chaine);
}
/* ###--------------------------------------------------------------### */
/* function : bvl_abl2str */
/* description : return a string corresponding to an expression */
/* called func. : */
/* ###--------------------------------------------------------------### */
char *bvl_abl2str (expr, chaine, size_pnt)
struct chain *expr; /* expression */
char *chaine; /* target string */
int *size_pnt; /* size of available space */
{
int operator;
char *oper ;
struct chain *operand ;
static char *str_z = NULL;
static char *str_o = NULL;
static char *str_d = NULL;
if (str_z == NULL)
{
str_z = namealloc ("'0'");
str_o = namealloc ("'1'");
str_d = namealloc ("'d'");
}
/* ###------------------------------------------------------### */
/* if there is not enough space left allocate a bigger block */
/* ###------------------------------------------------------### */
if (*size_pnt < (strlen (chaine) + 50))
{
*size_pnt = *size_pnt + 256;
chaine = (char *) realloc (chaine, *size_pnt);
}
/* ###------------------------------------------------------### */
/* if the expression is a terminal (atom) add its name to */
/* the previous string */
/* ###------------------------------------------------------### */
if (expr->NEXT == NULL)
{
if ((expr->DATA == (void *) str_z) ||
(expr->DATA == (void *) str_o) ||
(expr->DATA == (void *) str_d) )
strcat (chaine, expr->DATA);
else
strcat (chaine, bvl_vectorize (expr->DATA));
}
else
{
/* ###------------------------------------------------------### */
/* if the expression is not a terminal : */
/* - for unary operators (not, stable) add */
/* "operator ( operand )" to the previous string */
/* */
/* - for binary operators (and, or, nor, xor, ...) add */
/* "(operand operator operand operator operand ...)" */
/* ###------------------------------------------------------### */
operator = (int) ((struct chain *) expr->DATA)->DATA;
operand = (struct chain *)expr->NEXT->DATA;
if (operator == STABLE)
{
strcat (chaine, bvl_vectorize (operand->DATA));
strcat (chaine, "'STABLE");
}
else
{
if (operator == NOT)
{
strcat (chaine, "not (");
chaine = bvl_abl2str (operand, chaine, size_pnt);
}
else
{
oper = operToChar (operator);
strcat (chaine,"(");
while (expr = expr->NEXT)
{
chaine = bvl_abl2str (expr->DATA, chaine, size_pnt);
if (expr->NEXT)
{
strcat (chaine, " ");
strcat (chaine, oper);
strcat (chaine, " ");
}
}
}
strcat (chaine, ")");
}
}
return (chaine);
}

View File

@ -0,0 +1,20 @@
/* ###--------------------------------------------------------------### */
/* */
/* file : bvl_util.h */
/* date : Jun 15 1992 */
/* version : v102 */
/* author : Pirouz BAZARGAN SABET */
/* description : This file contains declaration of global and external */
/* variables and, functions used in `bvl_util.c` */
/* */
/* ###--------------------------------------------------------------### */
extern int BVL_LINNUM; /* file's line number */
extern char BVL_ERRFLG; /* Error flag */
extern char BVL_CURFIL[]; /* current file name */
static struct dct_entry *BVL_DCEHED; /* free dct_entry's head */
static struct dct_recrd *BVL_DCRHED; /* free dct_recrd's head */
static struct dct_entry *addent();
static struct dct_recrd *addrcd();

View File

@ -0,0 +1,32 @@
/* ###--------------------------------------------------------------### */
/* */
/* file : bvl_utype.h */
/* date : Jun 15 1992 */
/* version : v102 */
/* author : P.BAZARGAN L.A.TABUSSE VUONG H.N. */
/* content : declaration of external functions and global variables*/
/* used by yacc */
/* */
/* ###--------------------------------------------------------------### */
struct dct_entry
{
struct dct_entry *next;
struct dct_recrd *data;
char *key;
};
struct dct_recrd
{
struct dct_recrd *next;
char *key;
short fd0_val;
short fd1_val;
short fd2_val;
short fd3_val;
short fd4_val;
short fd5_val;
short fd6_val;
int pnt_val;
};

View File

@ -0,0 +1,141 @@
#
# This file is part of the Alliance CAD System
# Copyright (C) Laboratoire LIP6 - Département ASIM
# Universite Pierre et Marie Curie
#
# Home page : http://www-asim.lip6.fr/alliance/
# E-mail support : mailto:alliance-support@asim.lip6.fr
#
# This progam is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# Alliance VLSI CAD System is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with the GNU C Library; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# ,,,
# (o o)
# ####=====oOO--(_)--OOO==========================================####
# ## ##
# ## File : Makefike for PCBS ##
# ## Author : Francois DONNET ##
# ## Date : Apr 2001 ##
# ## ##
# ## E-mail support : alliance-support@asim.lip6.fr ##
# ## ##
# ####============================================================####
#
#
#
include $(ALLIANCE_TOP)/etc/$(ALLIANCE_OS).mk
include $(ALLIANCE_TOP)/etc/libraries.mk
DEBUG = -g -Wall #-DNO_HARD
CFLAGS = $(ALC_INC) -D$(ALLIANCE_OS) $(DEBUG)
YACC = yacc
#TARGET_BIN = ..
#PROFILE = -pg
#PURIFY = purify -logfile=pure.log
########################PARAMETRES DU PROGRAMME################################
EXE = emulbs
VERSION = 3.1
NBR_EMULBS31 = 4
###############################################################################
ALC_INC = \
-DNBR_EMULBS=$(NBR_EMULBS31) \
-DPROGRAM_NAME='"$(EXE)"' \
-DPROGRAM_VERSION='"$(VERSION)"' \
-DALLIANCE_VERSION=$(ALLIANCE_VERSION) \
-I$(ALLIANCE_INCLUDE) \
-DMLU_H='<$(MLU_H)>' \
-DMLO_H='<$(MLO_H)>' \
-DBHL_H='<$(BHL_H)>' \
-DBEH_H='<$(BEH_H)>' \
-DPPT_H='<$(PPT_H)>' \
-DPAT_H='<$(PAT_H)>' \
-DPHL_H='<$(PHL_H)>' \
-DLOG_H='<$(LOG_H)>' \
-DMUT_H='<$(MUT_H)>'
ALC_LIB = -lm \
-L$(ALLIANCE_LIB) \
$(MLO_L) \
$(BHL_L) \
$(BEH_L) \
$(PPT_L) \
$(PHL_L) \
$(PAT_L) \
$(LOG_L) \
$(MUT_L)
###############################################################################
SCE = emulbs.c util.c bstools.c infos.c verif.c traduction.c emul_yac.c emul_lex.c hardware_io.c
OBJ = emulbs.o util.o bstools.o infos.o verif.o traduction.o emul_yac.o emul_lex.o hardware_io.o
HEADERS = global.h util.h bstools.h infos.h verif.h traduction.h emul_yac.h emul31.h type_infos.h hardware_io.h
##+++++++++++++++++++++++++++++++les regles++++++++++++++++++++++++++++++++++##
$(TARGET_BIN)/$(EXE) : $(OBJ)
@echo -n "Generation de l'executable ($@)...."
$(PURIFY) $(CC) $(PROFILE) -o $(TARGET_BIN)/$(EXE) $(OBJ) $(ALC_LIB)
@echo "That's it !!"
.c.o :
@echo "Compilation de $< (options : '$(DEBUG)')"
$(CC) -c $(CFLAGS) $<
%.i : %.c
@echo "Preprocessing de $<"
$(CC) -E $(CFLAGS) $< > $@
##+++++++++++++++++++++++++++++++LEX&YACC++++++++++++++++++++++++++++++++++++##
emul_yac.c: emul.yac
${YACC} -d emul.yac
@${SED} -e "s/yy/emul_/g" -e "s/YY/EMUL_/g" y.tab.c > emul_yac.c
@${SED} -e "s/yy/emul_/g" -e "s/YY/EMUL_/g" y.tab.h > emul_yac.h
@${RM} y.tab.c y.tab.h
## sed remplace les noms globaux commencant par yy pour que deux parseurs cohabitent dans le meme programme
emul_lex.c: emul.lex
${LEX} ${LEXFLAGS} emul.lex
@${SED} -e "s/yy/emul_/g" -e "s/YY/EMUL_/g" lex.yy.c > emul_lex.c
@${RM} lex.yy.c
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
clean:
-$(RM) -f *.o
-$(RM) -f *~ core
-$(RM) -f emul_yac.h emul_yac.c emul_lex.c
## le tiret devant la commande signifie que **error 1** est ignore
realclean distclean : clean
-$(RM) -f $(TARGET_BIN)/$(EXE)
###############################################################################
###############################################################################
###############################################################################
#DO NOT DELETE

View File

@ -0,0 +1,37 @@
## Process this file with automake to produce Makefile.in
YACC = @YACC@ -d
DEFS = @DEFS@ -DEMULBS_NBR_EMULBS=4 -DEMULBS_VERSION=\"@EMULBS_VERSION@\" -DPROGRAM_NAME=\"emulbs\"
AM_CFLAGS = @ALLIANCE_CFLAGS@
bin_PROGRAMS = emulbs
CLEANFILES = emul_y.c emul_y.h emul_l.c y.tab.h y.tab.c
INCLUDES = -I$(top_builddir)/src/emulbs
emulbs_LDADD = @ALLIANCE_LIBS@ \
-lMpu \
-lMlu \
-lMlo \
-lBhl \
-lBeh \
-lPpt \
-lPhl \
-lPat \
-lLog \
-lMut
emulbs_SOURCES = emul31.h global.h infos.h util.c \
emul_l.l hardware_io.c traduction.c util.h \
bstools.c emul_y.y hardware_io.h traduction.h verif.c \
bstools.h emulbs.c infos.c type_infos.h verif.h
emul_y.c emul_y.h : $(srcdir)/emul_y.y
$(YACC) $(YFLAGS) $(srcdir)/emul_y.y && sed -e "s/yy/emul_/g" -e "s/YY/EMUL_/g" y.tab.c > emul_y.c && sed -e "s/yy/emul_/g" -e "s/YY/EMUL_/g" y.tab.h > emul_y.h
emul_l.c : $(srcdir)/emul_l.l emul_y.h
$(LEX) -t $(srcdir)/emul_l.l | sed -e "s/yy/emul_/g" -e "s/YY/EMUL_/g" > emul_l.c

View File

@ -0,0 +1,444 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Philippe OLEK, Olivier SIROL (1995) ##*/
/*## Authors : Eric MECHIN (1996) ##*/
/*## Authors : Francois Donnet (2001) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
#include <sys/types.h>
#include <sys/fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>
#include "global.h"
#define LABEL_BS_SIZE 30 /*taille des labels des patterns BS sauvegardées*/
/* check BS i/o in .pat file */
static int table_index[5];
/*****************************************************************************/
/*****************************************************************************\
fonction
envoie d'une PAPAT sur le port
// du PC LINUX
\*****************************************************************************/
static char* buf_papat(char* head, struct papat *ppapat)
{
struct paevt *ppaevt;
static char tdi = 0;
static char tms = 0;
static char trst = 0;
static char tck = 0;
for(ppaevt = ppapat->PAEVT; ppaevt; ppaevt = ppaevt->NEXT) {
if(ppaevt->INDEX == table_index[TCK]) tck = (ppaevt->USRVAL - '0') << TCK_OFFSET;
if(ppaevt->INDEX == table_index[TRST]) trst = (ppaevt->USRVAL - '0') << TRST_OFFSET;
if(ppaevt->INDEX == table_index[TMS]) tms = (ppaevt->USRVAL - '0') << TMS_OFFSET;
if(ppaevt->INDEX == table_index[TDI]) tdi = (ppaevt-> USRVAL - '0') << TDI_OFFSET;
}
*head = tck + trst + tms + tdi;
head++;
return head;
}
/*****************************************************************************\
fonction
recoie d'une PAPAT sur le port
// du PC LINUX
\*****************************************************************************/
static char* unbuf_papat(char* head, struct papat *ppapat)
{
struct paevt *ppaevt;
struct paiol *paiol;
struct paevt *parallel_evt = NULL;
char tdo;
char parallel_evt__USRVAL_not;
int index = 0;
static int parallel_num = 0;
static int parallel_line;
static char old_tdo = '9'; /*evenement precedent*/
static char usrval = '9'; /*evenement precedent*/
static unsigned long number_bs = 0;
ppapat->SIMFLAG = 'S';
tdo = ( (*head >> TDO_OFFSET) & 0x1 ) == 1 ? '+' : '-';
head++;
for(ppaevt = ppapat->PAEVT; ppaevt; ppaevt = ppaevt->NEXT)
{
if ( ppaevt->INDEX == table_index[TDO] )
{
usrval = ppaevt->USRVAL;
break;
}
}
/*hack: PAINI not in the right use. It is an event of // patterns !!! */
/* it has been produced by traduction.c in Envoi() */
if ( ppapat->PAINI )
{
parallel_evt = (struct paevt*) ppapat->PAINI;
/* si sur bs resultat oppose, alors sur // resultat oppose */
/* car il se peut que les cellules bs soient inverseuses */
/* construction de l'oppose*/
parallel_evt__USRVAL_not = parallel_evt->USRVAL == '+' ? '-' : '+';
parallel_evt->SIMVAL = tdo==usrval ? parallel_evt->USRVAL
: parallel_evt__USRVAL_not;
parallel_line = ppapat->LINE;
parallel_num = ppapat->TIME;
ppapat->PAINI = NULL; /*erase hacking*/
ppapat->LINE = 0;
ppapat->TIME = 0;
}
/* resultat ne correspond pas aux previsions */
if ( usrval != '*' && usrval != tdo )
{
EXECUTION_ERRORS ++;
if ( parallel_evt )
{
for ( paiol = PASEQ_PARALLEL->PAIOL; paiol; paiol = paiol->NEXT )
{
if ( index == parallel_evt->INDEX ) break;
index++;
}
if ( !paiol || ( paiol->MODE!='O' && paiol->MODE!='T' ) )
{
fprintf(stderr, __FUNCTION__": Output with index %d not found\n",index);
exit(1);
}
if (verbose_flag) {
fprintf(stderr,
"Error on pattern %d (line %d) : expecting '%c' actual '%c' on %s\n"
,parallel_num
,parallel_line
,parallel_evt->USRVAL
,parallel_evt->SIMVAL
,paiol->NAME);
}
}
else
{
if ( PASEQ_PARALLEL )
{
fprintf(stderr,
"SYNCHRONISATION ERROR!!! --> STOP next results will be wrong\n");
if (verbose_flag) {
fprintf(stderr,
"Error on pattern %d (line %d)\n"
,parallel_num
,parallel_line);
}
}
if (verbose_flag)
{
fprintf(stderr,
"Error on Boundary Scan pattern %ld (line %d %s) : Expecting '%c' actual '%c'\n"
,number_bs
,ppapat->LINE
,ppapat->LABEL ? ppapat->LABEL : ""
,usrval
,tdo);
}
if ( PASEQ_PARALLEL ) exit( 1 );
}
}
number_bs++;
/*event and paev not found, must create*/
if ( !ppaevt )
{
if ( tdo == old_tdo ) return head;
ppapat->PAEVT = pat_addpaevt(ppapat -> PAEVT, table_index[TDO], usrval );
ppaevt = ppapat->PAEVT;
}
ppaevt->SIMVAL = tdo;
old_tdo = tdo;
return head;
}
/*****************************************************************************\
fonction
envoie d'une serie dePAPAT sur le port
// du PC LINUX
\*****************************************************************************/
static struct papat *loc_hard_papat(struct papat *head, unsigned int burst_size)
{
struct papat *scanpat;
struct papat *ppapat;
char *send;
char *current;
unsigned int count;
send = mbkalloc( burst_size * sizeof(char) );
for(ppapat = head; ppapat; ppapat = ppapat->NEXT)
{
current = send;
count = 0;
for( scanpat = ppapat ; scanpat; scanpat = scanpat->NEXT )
{
current = buf_papat( current, scanpat );
count++;
if ( count >= burst_size ) break;
}
/*send and call in burst*/
write_read_port( send, count );
current = send;
count = 0;
for( scanpat = ppapat ; scanpat; scanpat = scanpat->NEXT )
{
current = unbuf_papat( current, scanpat );
count++;
if ( count >= burst_size ) break;
}
if ( !scanpat ) break;
ppapat = scanpat;
}/*fin boucle sur les patterns*/
mbkfree( send );
return head;
}
/*****************************************************************************\
fonction
envoie d'une serie dePAPAT sur le port
// du PC LINUX
\*****************************************************************************/
extern struct papat *hard_papat(struct papat *head, unsigned int burst_size)
{
/*default index*/
table_index[TRST] = TRST;
table_index[TMS] = TMS;
table_index[TCK] = TCK;
table_index[TDI] = TDI;
table_index[TDO] = TDO;
return loc_hard_papat(head, burst_size);
}
/*****************************************************************************\
fonction
envoie d'une PASEQ sur le port
// du PC LINUX
\*****************************************************************************/
extern struct paseq* hard_paseq( struct paseq* pat, unsigned int burst_size, unsigned long *time_tck )
{
struct timeb start_tck,end_tck; /* to compute exec time */
char *tdi = namealloc(TDI_NAME);
char *tms = namealloc(TMS_NAME);
char *trst = namealloc(TRST_NAME);
char *tck = namealloc(TCK_NAME);
char *tdo = namealloc(TDO_NAME);
int count;
struct paiol *ppaiol;
/* envoie des patterns sur la carte */
ftime(&start_tck);
fprintf(stdout,"\rExecuting %d patterns on %s... \r",
pat->PATNBR, current_lpscan_device() );
fflush(stdout);
table_index[TCK] = -1;
table_index[TDO] = -1;
table_index[TMS] = -1;
table_index[TCK] = -1;
table_index[TRST] = -1;
count = 0;
for( ppaiol = pat -> PAIOL; ppaiol; ppaiol = ppaiol->NEXT )
{
if( ppaiol->NAME == trst) table_index[TRST] = count;
else if( ppaiol->NAME == tms) table_index[TMS] = count;
else if( ppaiol->NAME == tck) table_index[TCK] = count;
else if( ppaiol->NAME == tdi) table_index[TDI] = count;
else if( ppaiol->NAME == tdo) table_index[TDO] = count;
count++;
}
if( table_index[TCK] == -1
|| table_index[TDO] == -1
|| table_index[TMS] == -1
|| table_index[TCK] == -1
|| table_index[TRST] == -1 )
{
fprintf(stderr,
"Patterns aren't boundary-scan IO (tdi, tdo, tms, trst, tck)\n");
exit(1);
}
/*send to hard*/
pat->CURPAT = loc_hard_papat( pat->CURPAT, burst_size );
ftime(&end_tck);
*time_tck +=
(end_tck.time-start_tck.time)*1000+end_tck.millitm-start_tck.millitm;
return pat;
}
/*****************************************************************************\
fonction
save some patterns
\*****************************************************************************/
extern void save_patterns(char *file, struct paseq* pat, unsigned long *time_io)
{
struct timeb start_io,end_io; /* to compute exec time */
const char* entete = PROGRAM_NAME " version " EMULBS_VERSION " for boundary scan";
ftime(&start_io);
fprintf(stdout,"\rSaving %d patterns in %s.pat... ",
pat->PATNBR, file);
fflush(stdout);
/*si pas encore commence a sauver*/
if ( !pat->DRVSEQ )
{
pat_frepacom(pat->CURCOM); /*commentaire debut fichier*/
pat->CURCOM = pat_addpacom(NULL,entete,0);
}
if ( pat_savpaseq(file, pat, LABEL_BS_SIZE) )
{
fprintf(stderr,"\nSaving failed!\n");
exit(1);
}
if ( pat->CURCOM )
{
pat_frepacom(pat->CURCOM); /*commentaire debut fichier*/
pat->CURCOM = NULL;
}
ftime(&end_io);
*time_io += (end_io.time-start_io.time)*1000 + end_io.millitm-start_io.millitm;
}
/*****************************************************************************\
fonction
load some patterns
\*****************************************************************************/
extern struct paseq* load_patterns(char *file, struct paseq* pat, unsigned int nb_pat, unsigned long *time_io)
{
struct timeb start_io,end_io; /* to compute exec time */
ftime(&start_io);
if (nb_pat <= 0 )
fprintf(stdout,"\rLoading all patterns from %s.pat... ",
file);
else
fprintf(stdout,"\rLoading %d patterns from %s.pat... ",
nb_pat, file);
fflush(stdout);
pat = pat_lodpaseq (file, pat, nb_pat);
if ( pat==NULL || pat->ERRFLG )
{
fprintf(stderr,"Loading failed!\n");
exit( 1 );
}
ftime(&end_io);
*time_io += (end_io.time-start_io.time)*1000 + end_io.millitm-start_io.millitm;
return pat;
}
/*****************************************************************************\
fonction
envoie d'une PASEQ sur le port
// du PC LINUX
\*****************************************************************************/
extern void hard_paseq_file(char *scefile, char *resfile, unsigned int nb_pat, unsigned int burst_size)
{
struct timeb start_prg,end_prg; /* to compute exec time */
unsigned long time_tck=0,time_io=0,time_prg=0; /* to compute exec time */
struct paseq *pat = NULL; /* for .pat file */
int pat_tot = 0;
if ( !scefile ) return;
if ( !execute_flag ) return;
ftime(&start_prg);
open_port(burst_size); /* ouverture du port et reset BS */
do
{
pat = load_patterns(scefile, pat, nb_pat, &time_io);
pat = hard_paseq( pat, burst_size, &time_tck );
if ( resfile ) save_patterns(resfile, pat, &time_io);
pat_tot += pat->PATNBR;
}
while ( pat->ENDFLG != 'Y' );
close_port(); /* reset BS et fermeture du port */
/*temps*/
ftime(&end_prg);
time_prg=
(end_prg.time-start_prg.time)*1000 + end_prg.millitm-start_prg.millitm;
statistic(time_prg, time_tck, time_io, pat_tot );
}
/*****************************************************************************/
/******************************* END OF FILE *********************************/
/*****************************************************************************/

View File

@ -0,0 +1,86 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Philippe OLEK, Olivier SIROL ##*/
/*## (Projet Maitrise EEA) ##*/
/*## Initial Revision : April 1995 ##*/
/*## Revision : 20 may 1995 ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
#ifndef _BSTESTHEADER_
#define _BSTESTHEADER_
/* ordre dans pattern TDI TDO TMS TRST TCK */
#define TDI 0
#define TDO 1
#define TMS 2
#define TRST 3
#define TCK 4
#define TDI_NAME "tdi"
#define TMS_NAME "tms"
#define TRST_NAME "trst"
#define TCK_NAME "tck"
#define TDO_NAME "tdo"
/*****************************************************************************\
fonction
envoie d'une serie dePAPAT sur le port
// du PC LINUX
\*****************************************************************************/
extern struct papat *hard_papat(struct papat *head, unsigned int burst_size) ;
/*****************************************************************************\
fonction
envoie d'une PASEQ sur le port
// du PC LINUX
\*****************************************************************************/
extern struct paseq* hard_paseq( struct paseq* pat, unsigned int burst_size, unsigned long *time_tck );
/*****************************************************************************\
fonction
save some patterns
\*****************************************************************************/
extern void save_patterns(char *file, struct paseq* pat, unsigned long *time_io);
/*****************************************************************************\
fonction
load some patterns
\*****************************************************************************/
extern struct paseq* load_patterns(char *file, struct paseq* pat, unsigned int nb_pat, unsigned long *time_io) ;
/*****************************************************************************\
fonction
envoie d'une PASEQ sur le port
// du PC LINUX
\*****************************************************************************/
extern void hard_paseq_file(char *file, char *resfile, unsigned int nb_pat, unsigned int burst_size);
#endif
/*****************************************************************************/
/******************************* END OF FILE *********************************/
/*****************************************************************************/

View File

@ -0,0 +1,28 @@
/*********** Donnees relatives a l'ensemble Boundary Scan ********************/
#define EMULBS_INST_SIZE 2 /*taille du registre instruction de la carte EMULBS 31*/
#define EMULBS_BS_SIZE 31 /*nombre de cellules BS dans EMUL31 Rq: de 0 a 30*/
#define EMULBS_BYPASS_SIZE 1 /*revient a indiquer le nbr de cycles de retard*/
#define EMULBS_BYPASS0_VALUE "00" /*instructions d'EMUL31*/
#define EMULBS_BYPASS1_VALUE "11"
#define EMULBS_INTEST_VALUE "10"
#define EMULBS_CONFIG_VALUE "01"
/*****************************************************************************/
/*****************************************************************************/
/***************************** END OF FILE ***********************************/
/*****************************************************************************/

View File

@ -0,0 +1,48 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Francois DONNET (1998) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
%{
#include "global.h"
#include "emul_y.h"
int NBR_LIGNES = 1;
%}
nbr (([1-9][0-9]*)|0)
/*les noms en vhdl ne peuvent avoir plusieurs tirets consecutifs, de plus ils ne peuvent finir par un tiret*/
mot ([a-zA-Z](_?[a-zA-Z0-9])*)
%%
[ \t] ;
\n {NBR_LIGNES++;}
[iI][nN] {return _IN;}
[oO][uU][tT] {return _OUT;}
[iI][nN][oO][uU][tT] {return _INOUT;}
[;]+ {return Pt_virg;}
: {return Db_pt;}
\<\= {return Assign;}
\( {return Par_ouv;}
\] {return Cro_fer;}
\) {return Par_fer;}
\[ {return Cro_ouv;}
{mot} {yylval.MOT=(char*)namealloc(yytext);
/*reservation espace memoire cf. MUT_H*/
return TMot;}
{nbr} {yylval.VAL=atoi(yytext);
return TNbr;}
\-\-.* ;
. {return *yytext;}
%%
int yywrap(){return 1;}

View File

@ -0,0 +1,233 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Francois DONNET (1998) ##*/
/*## Authors : Francois DONNET (2001) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
/***************** parseur etablissant les connections ***********************/
/*************** entre le PGA et les interfaces EMULBS 31 ********************/
/* */
/* parametres : FILE *yyin */
/* Infos *InfosVbe */
/* erreur : int FLAG_ERR */
/* */
/*****************************************************************************/
/*
--exemple for emul_connexions
--left-hand is for EMULBS connector
--right-hand is for PGA connector
0 <=in a(1);
185 <=out b(2);
56 <=inout toto;
76 <=in g;
80 <=in a(0);
*/
%{
#include "global.h"
extern FILE* yyin;
extern int yylex(); /*fct du lexeur emul.lex*/
extern Infos *InfosVbe; /*resultat final du parseur*/
extern int NBR_LIGNES; /*pour message d'erreur*/
static int FLAG_ERR; /*si une erreur est arrivee*/
static int BS_Card_Max;
static Cellules **BS_Card; /*lien entre n° et EMUL*/
void emul_flag(int x);
%}
%union {
int VAL;
char *MOT;
}
%token _IN
%token _OUT
%token _INOUT
%token Pt_virg
%token Db_pt
%token Assign
%token TNbr
%token TMot
%token Lettre
%token Par_ouv Par_fer
%token Cro_ouv Cro_fer
%type <MOT> rconnector
%type <VAL> rtype
%type <MOT> TMot
%type <VAL> TNbr
%type <VAL> rindex
%start fichier
%%
fichier
:
{
Infos* inf;
Cellules* cell;
int count = 0;
/*initialisation*/
FLAG_ERR=0;
BS_Card_Max = 0;
for ( inf = InfosVbe; inf; inf = inf->NEXT ) BS_Card_Max += inf->BS_SIZE;
BS_Card = (Cellules**) mbkalloc(sizeof(Cellules*) * BS_Card_Max);
for ( inf = InfosVbe; inf; inf = inf->NEXT)
for (cell = inf->CELL; cell; cell = cell->NEXT) BS_Card[count++] = cell;
}
..declarations..
{
mbkfree(BS_Card);
if ( FLAG_ERR )
{
fclose(yyin);
exit(1);
}
}
;
declaration
:rdonnee
|error /*gestion des erreurs*/
{/*synchronisation avec point virgule ou fin de fichier*/
while (yychar!=Pt_virg && yychar!=0) yychar=yylex();
yychar=yylex();
yyerrok;}
;
rdonnee
:TNbr
Assign
rtype
rconnector
Pt_virg
{
int t_Nbr = $1;
int t_type = $3;
char* t_connector = $4;
Cellules *cell;
/* il y a un nombre maximum de connecteurs sur la carte */
if ( t_Nbr >= BS_Card_Max || t_Nbr < 0 )
{
fprintf(stderr,"%d: EMULBS31 n°%d doesn't exist! Index must be between 0 and %d\n",
NBR_LIGNES, t_Nbr, BS_Card_Max-1);
emul_flag(-1);
break;
}
/* alimentation Vdd du CHIP */
if ( isvdd(t_connector) || isvss(t_connector) )
{
fprintf(stderr,"%d: power %s shouldn't be connected!\n", NBR_LIGNES, t_connector);
emul_flag(-3);
break;
}
/******* chargement des donnees ******/
cell = BS_Card[t_Nbr];
/* connecteur sur carte deja utilise */
if ( cell->NAME )
{
fprintf(stderr,"%d: connector n°%d already used by %s!\n", NBR_LIGNES, t_Nbr, cell->NAME);
emul_flag(-2);
break;
}
cell->MODE = t_type;
cell->NAME = t_connector;
}
;
..declarations..
:/*empty*/
|declaration ..declarations..
;
rconnector
:TMot rindex {char memo = SEPAR; SEPAR=' '; $$=nameindex($1,$2); SEPAR=memo;}
|TMot {$$=$1;}
;
rindex:
Par_ouv
TNbr
Par_fer
{$$=$2;}
;
rtype
:_IN {$$=MODE_IN;}
|_OUT {$$=MODE_OUT;}
|_INOUT {$$=MODE_INOUT;}
;
%%
/**************************** change le FLAG_ERR *****************************/
void emul_flag(int x)
{
/*sauvegarde de la premiere erreur ou du dernier warning*/
if (FLAG_ERR>=0) FLAG_ERR=x;
}
/****************** traitement des erreurs de syntaxe ************************/
int yyerror()
{
fprintf(stderr,"%d: syntax error",NBR_LIGNES);
switch ((int)yychar) {
case TMot: fprintf(stderr," append at '%s'\n",yylval.MOT);break;
case TNbr: fprintf(stderr," append at '%d'\n",yylval.VAL);break;
case Pt_virg: fprintf(stderr," append at ';'\n");break;
case Assign: fprintf(stderr," append at '<='\n");break;
case Db_pt: fprintf(stderr," append at ':'\n");break;
case Cro_ouv: fprintf(stderr," append at '['\n");break;
case Cro_fer: fprintf(stderr," append at ']'\n");break;
case Par_ouv: fprintf(stderr," append at '('\n");break;
case Par_fer: fprintf(stderr," append at ')'\n");break;
case _IN: fprintf(stderr," append at 'in'\n");break;
case _OUT: fprintf(stderr," append at 'out'\n");break;
case _INOUT: fprintf(stderr," append at 'inout'\n");break;
case 0: fprintf(stderr," ';' is missing\n");break;/*EOF*/
default: fprintf(stderr," for '%c' not allowed!\n",yychar);
}
emul_flag(-1);
return 1;
}
/*****************************************************************************/
/**************************** END of LEX&YACC ********************************/
/*****************************************************************************/

View File

@ -0,0 +1,242 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Philippe OLEK, Olivier SIROL (1995) ##*/
/*## Authors : Eric MECHIN (1996) ##*/
/*## Authors : Francois DONNET (1998) ##*/
/*## ##*/
/*## Modifications : Ana ABRIL (2000) ##*/
/*## Francois Donnet (2001) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
/****************************************************************************/
#include "global.h"
/************************* version de PcBs ***********************************/
/****************************************************************************/
/* Variables globales */
/****************************************************************************/
/* flags and vars for command line processing */
int verbose_flag = 0; /*affichage de tous les commmentaires */
int execute_flag = 0; /*mode avec hardware */
int check_flag = 0; /*est-ce le mode check */
int lpscan_flag; /*type of hardware device*/
int pci_flag; /*type of hardware device*/
static unsigned int patlimit_flag = PAT_SIZE; /*nbr de patterns dans une sequence */
static unsigned int burstlimit_flag = BURST_SIZE; /* taille du burst sur le port */
static char* emulbs_flag = NULL; /*est-ce pour l'interface EMULBS31? */
static char* loadPatSRC_flag = NULL; /*charger pattern */
static char* savePatSRC_flag = NULL; /*sauvegarder pattern */
static char* savePatBS_flag = NULL; /*sauvegarder pattern BS */
/****************************************************************************/
/* Aide sur la ligne de commande */
/****************************************************************************/
static void usage()
{
fprintf(stdout,"
%s [ -hv ] [ --pci | --parallel ] [ -l <number> ] [ -b <number> ]
[ <source.PAT> [ <res.PAT> ] ] [ -e <connections_file> [ -s <bs.PAT> ] ]
",PROGRAM_NAME);
}
/****************************************************************************/
/****************************************************************************/
static void help()
{
fprintf(stdout,"
%s [ -hv ] [ --pci | --parallel ] [ -l <number> ] [ -b <number> ]
[ <source.PAT> [ <res.PAT> ] ] [ -e <connections_file> [ -s <bs.PAT> ] ]
-h,--help Display this current message.
-v,--verbose Display all warnings and actions.
-l,--load Load only <number> patterns from <source.PAT> to save memory.
-b,--burst Execute a burst of <number> boundary-scan patterns on device.
<source.PAT> Functional or boundary-scan patterns to execute.
<res.PAT> Functional or boundary-scan executed patterns.
-e,--emulbs Load <connections_file> which describes the device connections
between the chip and the test card to mute functional patterns
<source.PAT> into boundary-scan patterns <bs.PAT>.
-s,--save Save boundary-scan patterns in <bs.PAT>.
--pci Check device, execute <source.PAT> on device by pci port
and save result in <res.PAT>.
--parallel Check device, execute <source.PAT> on device by parallel port
and save result in <res.PAT>.
",PROGRAM_NAME);
}
/******************************************************************************/
/* set variables to values of command line */
/******************************************************************************/
static void set_param(int argc, char* argv[])
{
int i;
if ( argc <= 1 )
{
usage();
exit(0);
}
/*verify for Sun and Solaris. getopt() isn't the same than Linux_elf */
for ( i=1; i<argc; i++ )
{
if ( !strcmp(argv[i],"-h") || !strcmp(argv[i],"--help") )
{
help();
exit(0);
}
if ( !strcmp(argv[i],"-v") || !strcmp(argv[i],"--verbose") )
{
verbose_flag = 1;
continue;
}
if ( !strcmp(argv[i],"-b") || !strcmp(argv[i],"--burst") )
{
if (++i>=argc) {
help();
exit(1);
}
burstlimit_flag = atoi( argv[i] );
continue;
}
if ( !strcmp(argv[i],"-l") || !strcmp(argv[i],"--load") )
{
if (++i>=argc) {
help();
exit(1);
}
patlimit_flag = atoi( argv[i] );
continue;
}
if ( !strcmp(argv[i],"-e") || !strcmp(argv[i],"--emulbs") )
{
if (++i>=argc) {
help();
exit(1);
}
emulbs_flag = argv[i];
continue;
}
if ( !strcmp(argv[i],"-s") || !strcmp(argv[i],"--save") )
{
if (++i>=argc) {
help();
exit(1);
}
savePatBS_flag = argv[i];
continue;
}
if ( !strcmp(argv[i],"--pci") )
{
pci_flag = 1;
continue;
}
if ( !strcmp(argv[i],"--parallel") )
{
lpscan_flag = 1;
continue;
}
if ( argv[i][0]=='-' ) /*invalid option*/
{
fprintf(stderr, "Invalid option '%s'\n", argv[i]);
help();
exit(1);
}
if ( !loadPatSRC_flag )
{
loadPatSRC_flag = argv[i];
continue;
}
if ( !savePatSRC_flag )
{
savePatSRC_flag = argv[i];
continue;
}
help();
exit(1);
}
/*if there is source and hardware then execute*/
if ( ( pci_flag || lpscan_flag ) && loadPatSRC_flag ) execute_flag = 1;
/*coherence in options*/
if ( ( savePatBS_flag && !emulbs_flag )
|| ( lpscan_flag && pci_flag )
|| ( !loadPatSRC_flag && !pci_flag && !lpscan_flag ) )
{
help();
exit(1);
}
}
/****************************************************************************/
/****************************************************************************/
extern int main(int argc, char *argv[])
{
/****initialisation environnement****/
mbkenv();
initializeBdd(SMALL_BDD); /*SMALL_BDD=0*/
alliancebanner_with_authors("EmulBs", EMULBS_VERSION "[2002/02/18]",
"Emulated Boundary-Scan Tester Platform",
"2001", ALLIANCE_VERSION,
"Ana ABRIL, François DONNET, Eric MECHIN, Philippe OLEK");
set_param(argc,argv);
/*variable globale InfosVbe */
creer_InfosVbe_EMULBS();
/****traitement****/
/* Chargement de la description du boundary scan */
if (emulbs_flag)
{
description_cartes(emulbs_flag);
VerificationsInfos();
}
/*verification hardware*/
if (pci_flag || lpscan_flag) {
fprintf(stdout,"Checking DUT connected to %s\n",
(char*) current_lpscan_device());
if (check_mode()) exit(1);
}
if ( emulbs_flag && loadPatSRC_flag ) /*traduction en bs puis peut etre envoi*/
{
traduire( loadPatSRC_flag, savePatSRC_flag, savePatBS_flag,
patlimit_flag, burstlimit_flag );
}
else if ( loadPatSRC_flag )/*envoi sur hard sans traduction*/
{
hard_paseq_file( loadPatSRC_flag, savePatSRC_flag,
patlimit_flag, burstlimit_flag );
}
exit(0);
}
/*****************************************************************************/
/******************************** END OF FILE ********************************/
/*****************************************************************************/

View File

@ -0,0 +1,49 @@
/****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <malloc.h>
#include <ctype.h>
#include <fcntl.h>
#include <sys/timeb.h>
#include <mut.h>
#include <log.h>
#include <mlo.h>
#include <beh.h>
#include <pat.h>
#include <phl.h>
#include <ppt.h>
/*****************************************************************************/
/* Les variables de chaque fichier .c */
#include "type_infos.h"
#include "infos.h"
#include "verif.h"
#include "traduction.h"
#include "util.h"
#include "bstools.h"
#include "hardware_io.h"
/************************ presentation des patterns **************************/
#define BS_ESPACE 2 /*espaces entre les veteurs BS*/
/****************************************************************************/
/*nombre de patterns par sequence chargee*/
#define BURST_SIZE 1024
#define PAT_SIZE 512
/*****************************************************************************/
/************************** variables globales *******************************/
extern struct Infos *InfosVbe; /* Pour les informations */
/* flags and vars for command line processing */
extern int verbose_flag; /*affichage de tous les commmentaires */
extern int execute_flag; /*mode avec hardware */
extern int lpscan_flag; /*type of hardware device*/
extern int pci_flag; /*type of hardware device*/
extern int EXECUTION_ERRORS; /*nombre d'erreurs a l'execution*/
extern struct paseq* PASEQ_PARALLEL; /*sequence de patterns en cours de traduction*/
/*****************************************************************************/
/******************************* END OF FILE *********************************/
/*****************************************************************************/

View File

@ -0,0 +1,709 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Francois Donnet (2001) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
#include <sys/types.h>
#include <sys/fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>
#include "global.h"
#define NOMBRE_ESSAI_MAX 3
#define MAX_WAIT 10000
#ifndef NO_HARD /* without the testing card*/
/* GLOBAL VARS **********************************************************/
static char hostname[256];
static char PORT_ALREADY_OPENED = 0 ;
#if 0
static char *PciBuf_Write_Read; /* zone mem physique pour le dma*/
#endif
/* file descriptor of lpscan dev */
static int fd;
#endif
/*****************************************************************************/
/* FONTIONS SE SERVANT DU DRIVER LPSCAN *********************************/
/* elles exit(LPSCAN_ERROR) toutes sauf close_port en cas d'erreur */
/*****************************************************************************/
/*****************************************************************************/
extern char *current_lpscan_device()
{
if ( pci_flag ) return "aniscan";
else if ( lpscan_flag ) return "/dev/lpscan0";
else
{
fprintf(stderr, "No device defined\n");
exit(1);
return NULL;
}
}
/*****************************************************************************/
/* fonction de reset du */
/* circuit , 5 cycles de */
/* TCK avec TMS=1 */
/*****************************************************************************/
static struct papat *reset_bs(struct papat* ppapat)
{
char valeur[5];
int j;
valeur[TDO] = '*';
valeur[TDI] = '0';
valeur[TMS] = '1';
valeur[TRST] = '1';
valeur[TCK] = '0';
for(j = 0; j < 5; j++) { /* 5 cycle pour effectuer un reset */
ppapat = TAP_in(ppapat, valeur, namealloc("Reset_BS"));
}
valeur[TMS] = '0';
ppapat = TAP_in(ppapat, valeur, namealloc("Reset_BS"));
/* Un coup de TRST */
valeur[TRST] = '0';
ppapat = TAP_in(ppapat, valeur, namealloc("Reset_BS"));
/* retour a RUN_TEST_IDLE */
valeur[TRST] = '1';
ppapat = TAP_in(ppapat, valeur, namealloc("Reset_BS"));
return ppapat;
}
/*****************************************************************************/
/* renvoie la taille du scan */
/*****************************************************************************/
static int get_motif(struct papat* ppapat)
{
long motif = 0;
int i = 0;
int simval = 0;
struct paevt *paevt;
for ( ppapat = ppapat->NEXT ; ppapat; ppapat = ppapat->NEXT )
{
for ( paevt = ppapat->PAEVT; paevt; paevt = paevt->NEXT )
{
if ( TDO == paevt->INDEX ) simval = paevt->SIMVAL == '+' ? 1 : 0;
}
motif <<= 1;
motif += simval;
i++;
if (motif == SCAN_MOTIF) break;
/*skip the second cycle*/
ppapat = ppapat->NEXT;
if ( !ppapat ) break;
}
return i - 31 /*taille du motif*/;
}
/*****************************************************************************/
/* fonction de send a motif */
/*****************************************************************************/
static struct papat* shift_motif(struct papat* ppapat)
{
char valeur[5];
long motif = SCAN_MOTIF;
int i;
/* dans l ordre TDI TMS TRST TCK */
valeur[TDO] = '*';
valeur[TDI] = '0';
valeur[TMS] = '0';
valeur[TRST] = '1';
valeur[TCK] = '0';
/* shift en attendant de retrouver le motif */
for (i = 1; i<=MAX_SHIFT + 31/*size of motif*/; i++)
{
valeur[TDI] = ( (motif & 0x80000000) >> 31) + '0';
if (i<=32) ppapat = TAP_in(ppapat, valeur, namealloc("Motif"));
else ppapat = TAP_in(ppapat, valeur, namealloc("Scan"));
motif<<=1;
}
return ppapat;
}
/*****************************************************************************/
/* fonction de shift_ir */
/*****************************************************************************/
static struct papat* shift_ir(struct papat* ppapat)
{
char valeur[5];
/* dans l ordre TDI TMS TRST TCK */
valeur[TDO] = '*';
valeur[TDI] = '0';
valeur[TMS] = '0';
valeur[TRST] = '1';
valeur[TCK] = '0';
/* RUN TEST IDLE */
ppapat = TAP_in(ppapat, valeur, namealloc("Run_Test_Idle"));
/* Select DR */
valeur[TMS] = '1';
ppapat = TAP_in(ppapat, valeur, namealloc("Select_dr"));
/* Select IR */
ppapat = TAP_in(ppapat, valeur, namealloc("Select_ir"));
/* Capture IR */
valeur[TMS] = '0';
ppapat = TAP_in(ppapat, valeur, namealloc("Capture_ir"));
/* Shift IR */
ppapat = TAP_in(ppapat, valeur, namealloc("Shift_ir"));
return ppapat;
}
/*****************************************************************************/
/* fonction de shift_dr */
/*****************************************************************************/
static struct papat* shift_dr(struct papat* ppapat)
{
char valeur[5];
/* dans l ordre TDI TMS TRST TCK */
valeur[TDO] = '*';
valeur[TDI] = '0';
valeur[TMS] = '0';
valeur[TRST] = '1';
valeur[TCK] = '0';
/* RUN TEST IDLE */
ppapat = TAP_in(ppapat, valeur, namealloc("Run_Test_Idle"));
/* Select DR */
valeur[TMS] = '1';
ppapat = TAP_in(ppapat, valeur, namealloc("Select_dr"));
/* Capture DR */
valeur[TMS] = '0';
ppapat = TAP_in(ppapat, valeur, namealloc("Capture_dr"));
/* Shift DR */
ppapat = TAP_in(ppapat, valeur, namealloc("Shift_dr"));
return ppapat;
}
/*****************************************************************************/
/* fonction de verification de presence LPT1 */
/*****************************************************************************/
static void checkLPT()
{
#ifndef NO_HARD /* without the testing card*/
int res;
if (fd <= 0 )
{
fprintf(stderr, __FUNCTION__ ": Device is not opened\n");
exit(LPSCAN_ERROR);
}
errno = 0;
if ((res = (ioctl(fd, CHECK_CARD_PRESENT, NULL))) < 0 || errno ) {
fprintf(stderr, "#### ");
perror("Error accessing " PROGRAM_NAME " device (ioctl)");
exit(LPSCAN_ERROR);
}
if (res != 1) {
gethostname(hostname,255);
fprintf(stderr, "Cannot find Boundary-scan Card on this machine (%s)\n",
hostname);
exit(LPSCAN_ERROR);
}
#endif
}
/*****************************************************************************/
/* fonction de determination */
/* de la longueur du registre */
/* instruction du circuit */
/*****************************************************************************/
extern int check_mode( )
{
#ifndef NO_HARD /* without the testing card*/
int rinst=0;
int rbs=0;
int rbypass=0;
Infos *inf;
int j, i, lg_inst, lg_bs, lg_bypass;
int emulbs = 1;/*pour l'instant c'est un hardware EMULBS31*/
char valeur[5];
struct papat *ppapat;
for (inf=InfosVbe; inf; inf=inf->NEXT)
{
/*taille des registres instructions concatenes*/
rinst += inf->INST_SIZE;
/*taille de toutes les chaines bs concatenees*/
rbs += inf->BS_SIZE;
/*longueur du bypass 1 bit de bypass*/
rbypass += inf->BYPASS_SIZE;
}
if ( !InfosVbe )
{
fprintf(stderr, __FUNCTION__ "No info file\n");
exit(1);
}
/* -------------- */
/* Check du RI */
/* -------------- */
/* BS : entrees positionnees avant front montant
sortie valides apres front descendant */
open_port(BURST_SIZE); /* ouverture du port et reset BS */
ppapat = reset_bs( NULL );
ppapat = shift_ir( ppapat );
ppapat = (struct papat*) reverse( (chain_list*) ppapat);
ppapat = hard_papat(ppapat, BURST_SIZE);
pat_frepapat( ppapat );
/* send motif (shift IR) */
/* shift en attendant de retrouver le motif */
ppapat = shift_motif( NULL );
ppapat = (struct papat*) reverse( (chain_list*) ppapat);
ppapat = hard_papat(ppapat, BURST_SIZE);
lg_inst = get_motif( ppapat );
pat_frepapat( ppapat );
if (lg_inst >= MAX_SHIFT) {
fprintf(stderr, "Cannot check INSTRUCTION REGISTER (longer than %d bits ???)\n",lg_inst);
fprintf(stderr, "You must check the card connection...\n");
close_port();
return(1);
}
fprintf(stdout,"INSTRUCTION REGISTER seems to be %d bits long\n",lg_inst);
/* -------------- */
/* Check du BYPASS */
/* -------------- */
/* Chargement de l'instruction BYPASS */
/* depuis le reset */
/* prevention des courts circuits */
ppapat = reset_bs(NULL);
ppapat = shift_ir( ppapat );
/* dans l ordre TDI TMS TRST TCK */
valeur[TDO] = '*';
valeur[TDI] = '1';
valeur[TMS] = '0';
valeur[TRST] = '1';
valeur[TCK] = '0';
for(i = 0; i < lg_inst - 1; i++) {
/* Instruction BYPASS : des 1 partout */
ppapat = TAP_in(ppapat, valeur, namealloc("Shift_ir"));
}
/* Exit1_ir */
valeur[TMS] = '1';
valeur[TDI] = '1';
ppapat = TAP_in(ppapat, valeur, namealloc("Exit1_ir"));
/* Update_ir */
valeur[TDI] = '0';
ppapat = TAP_in(ppapat, valeur, namealloc("Update_ir"));
ppapat = shift_dr( ppapat );
ppapat = (struct papat*) reverse( (chain_list*) ppapat);
ppapat = hard_papat(ppapat, BURST_SIZE);
pat_frepapat( ppapat );
/* send motif (shift DR) */
/* shift en attendant de retrouver le motif */
ppapat = shift_motif( NULL );
ppapat = (struct papat*) reverse( (chain_list*) ppapat);
ppapat = hard_papat(ppapat, BURST_SIZE );
lg_bypass = get_motif( ppapat );
pat_frepapat( ppapat );
if (lg_bypass >= MAX_SHIFT) {
fprintf(stderr, "Cannot check BYPASS register (longer than %d bits ???)\n",lg_bypass);
fprintf(stderr, "You must check the card connection...\n");
close_port();
return(1);
}
fprintf(stdout,"BYPASS register seems to be %d bits long\n",lg_bypass);
/* ---------------------- */
/* Check du BOUNDARY-SCAN */
/* ---------------------- */
/* prevention des courts circuits */
ppapat = reset_bs( NULL );
ppapat = shift_ir( ppapat );
/* dans l ordre TDI TMS TRST TCK */
valeur[TDO] = '*';
valeur[TDI] = '0';
valeur[TMS] = '0';
valeur[TRST] = '1';
valeur[TCK] = '0';
for(i = 1; i <= lg_bypass; i++)
{
/* Instruction INTEST : que des 1 et un 0 */
valeur[TDI] = '1';
for(j = 1; j < lg_inst/lg_bypass; j++)
{
ppapat = TAP_in(ppapat, valeur, namealloc("Shift_ir"));
}
valeur[TDI] = '0';
ppapat = TAP_in(ppapat, valeur, namealloc("Shift_ir"));
}
/* Exit1_ir */
valeur[TMS] = '1';
valeur[TDI] = '1';
ppapat = TAP_in(ppapat, valeur, namealloc("Exit1_ir"));
/* Update_ir */
valeur[TDI] = '0';
ppapat = TAP_in(ppapat, valeur, namealloc("Update_ir"));
/* Shift_dr */
ppapat = shift_dr( ppapat );
ppapat = (struct papat*) reverse( (chain_list*) ppapat);
ppapat = hard_papat(ppapat, BURST_SIZE);
pat_frepapat( ppapat );
/* send motif (shift DR) */
/* shift en attendant de retrouver le motif */
ppapat = shift_motif( NULL );
ppapat = (struct papat*) reverse( (chain_list*) ppapat);
ppapat = hard_papat(ppapat, BURST_SIZE);
lg_bs = get_motif( ppapat );
pat_frepapat( ppapat );
if (lg_bs >= MAX_SHIFT) {
fprintf(stderr, "Cannot check BOUNDARY-SCAN register (longer than %d bits ???)\n",lg_bs);
fprintf(stderr, "You must check the card connection...\n");
close_port();
return(1);
}
fprintf(stdout,"BOUNDARY-SCAN register seems to be %d bits long\n", lg_bs);
close_port();
if ( lg_bypass == 1 )
fprintf(stdout,"Boundary scan chip recognized : RI=%d, BYPASS=%d, BS=%d\n",
lg_inst, lg_bypass, lg_bs);
else fprintf(stdout,"%d Boundary scan chips recognized : RI=%d, BYPASS=%d, BS=%d\n",
lg_bypass, lg_inst/lg_bypass, lg_bypass/lg_bypass, lg_bs/lg_bypass);
if ( rinst != lg_inst ) {
fprintf(stdout,"Error : %s was attempting a INSTRUCTION REGISTER of %d bits long\n",
PROGRAM_NAME,
rinst);
emulbs = 0;
}
if ( rbypass != lg_bypass ) {
fprintf(stdout,"Error : %s was attempting a BYPASS of %d bits long\n", PROGRAM_NAME,
rbypass);
emulbs = 0;
}
if ( rbs != lg_bs ) {
fprintf(stdout,"Error : %s was attempting a BOUNDARY-SCAN of %d bits long\n",
PROGRAM_NAME, rbs);
emulbs = 0;
}
if ( !emulbs )
{
fprintf(stdout,
"Error : BOUNDARY-SCAN register seems to be other than the EMULBS31 card interface\n");
close_port();
return (1);
}
else fprintf(stdout,"The %d EMULBS31 have been recognized\n", lg_bypass);
#endif
return(0);
}
/*****************************************************************************/
/*****************************************************************************/
extern int write_read_port( char* buf, unsigned int size)
{
#ifndef NO_HARD /* without the testing card*/
int i, nb_read, nb_write;
if (lpscan_flag)
{
if (!fd)
{
fprintf(stderr,__FUNCTION__": device not opened\n");
exit( 1 );
}
for (i=0; i<size; i++)
{
errno = 0;
nb_write = write(fd, buf+i, 1);
if ( errno )
{
perror("Error writing " PROGRAM_NAME " device");
exit(LPSCAN_ERROR);
}
if ( nb_write != 1 )
{
fprintf(stderr, PROGRAM_NAME " can only write %d byte\n", nb_write);
exit(LPSCAN_ERROR);
}
errno = 0;
nb_read = read(fd, buf+i, 1);
if ( errno )
{
perror("Error writing " PROGRAM_NAME " device");
exit(LPSCAN_ERROR);
}
if ( nb_read != 1 )
{
fprintf(stderr, PROGRAM_NAME " can only read %d byte\n", nb_read);
exit(LPSCAN_ERROR);
}
}
}
else if ( pci_flag )
{
#if 0
if (!PciBuf_Write_Read)
{
fprintf(stderr,__FUNCTION__": device not opened\n");
exit( 1 );
}
/*copie en memoire physique a une adresse fixe*/
for (i=0; i<size; i++) *( PciBuf_Write_Read + i ) = *( buf + i );
aniscan( PciBuf_Write_Read, size );
/*recopie en memoire virtuelle*/
for (i=0; i<size; i++) *( buf + i ) = *( PciBuf_Write_Read + i );
#else
fprintf(stderr, "PCI not yet implemented....\n");
exit(1);
#endif
} /*pci bus*/
else
{
fprintf(stderr, "No device selected pci, parallel....\n");
exit(1);
}
#endif
return 0;
}
/***************************************/
/* fonction d ouverture du port // */
/***************************************/
extern void open_port(int DmaBurst_size)
{
#ifndef NO_HARD /* without the testing card*/
int erreur;
int nombre_essai = 0;
int wait;
struct papat *ppapat;
if (PORT_ALREADY_OPENED) return ;
if (lpscan_flag)
{
errno = 0;
fd = open(current_lpscan_device(), O_RDWR) ;
/* On va essayer d'attendre si c'est occupe */
while ((errno == EBUSY) && (fd < 0)) {
if (nombre_essai > NOMBRE_ESSAI_MAX) break;
wait = 0 ;
while (wait < MAX_WAIT) wait++;
fprintf(stderr,"%s device is busy. Trying again ...\n",PROGRAM_NAME);
fd = open(current_lpscan_device(), O_RDWR) ;
nombre_essai++;
}
if ( fd < 0 ) {
erreur = errno;
perror("Error opening " PROGRAM_NAME " device");
switch (erreur) {
case EBUSY : fprintf(stderr,
"%s device is currently in use. Please try later\n",PROGRAM_NAME);
break;
default :
gethostname(hostname,255);
fprintf(stderr,"Cannot find Boundary-scan Card on this machine (%s)\n"
,hostname);
}
exit(LPSCAN_ERROR);
}
}/*lpscan*/
else if ( pci_flag )
{
#if 0
ani_init( PciBuf_Write_Read, DmaBurst_size );
#else
fprintf(stderr, "PCI not yet implemented....\n");
exit(1);
#endif
} /*pci bus*/
else
{
fprintf(stderr, "No device selected pci, parallel....\n");
exit(1);
}
PORT_ALREADY_OPENED = 1;
checkLPT(); /* carte parallele OK ? */
/* prevention des courts circuits */
ppapat = reset_bs( NULL );
ppapat = (struct papat*) reverse( (chain_list*) ppapat);
ppapat = hard_papat(ppapat, BURST_SIZE);
pat_frepapat( ppapat );
#endif
}
/*****************************************************************************/
/* fonction de fermeture du port // */
/*****************************************************************************/
extern void close_port()
{
#ifndef NO_HARD /* without the testing card*/
struct papat *ppapat;
if (!PORT_ALREADY_OPENED) return ;
/* prevention des courts circuits */
ppapat = reset_bs( NULL );
ppapat = (struct papat*) reverse( (chain_list*) ppapat);
ppapat = hard_papat(ppapat, BURST_SIZE);
pat_frepapat( ppapat );
if (lpscan_flag)
{
errno = 0;
if (close(fd) < 0 || errno ) { /* fermeture du port // */
fprintf(stderr, "#### ");
perror("Error closing " PROGRAM_NAME " device");
exit(-1);
}
fd = NULL;
} /*lpscan*/
else if ( pci_flag )
{
#if 0
/* desallouer? */
PciBuf_Write_Read = NULL;
#else
fprintf(stderr, "PCI not yet implemented....\n");
exit(1);
#endif
} /*pci bus*/
else
{
fprintf(stderr, "No device selected pci, parallel....\n");
exit(1);
}
PORT_ALREADY_OPENED = 0;
#endif
}
/*****************************************************************************/
/******************************* END OF FILE *********************************/
/*****************************************************************************/

View File

@ -0,0 +1,80 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Philippe OLEK, Olivier SIROL ##*/
/*## (Projet Maitrise EEA) ##*/
/*## Initial Revision : April 1995 ##*/
/*## Revision : 20 may 1995 ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
#ifndef _BSHARDHEADER_
#define _BSHARDHEADER_
/* index des signaux boundary-scan */
/* TCK relie a DATA0 */
/* TRST relie a DATA1 */
/* TMS relie a DATA2 */
/* TDI relie a DATA3 */
/* TDO relie a STATUS10 (SELECT) */
#define TDI_OFFSET 3
#define TMS_OFFSET 2
#define TRST_OFFSET 1
#define TCK_OFFSET 0
#define TDO_OFFSET 4 /* STATUS REGISTER de la carte parallele bit 4 */
/* motif que l'on envoi au TAP (mode check) */
#define SCAN_MOTIF 0xE04C4F48 /* "BS" (32 bits) */
#define MAX_SHIFT 5000 /* nb de shift max avant de laisser tomber */
/* code d'erreur renvoye lors d'un LPSCAN ERROR */
#define LPSCAN_ERROR 10
/* commandes IOCTL du driver LPSCAN */
#define CHECK_CARD_PRESENT 0x0001 /* pour la verification de */
/* presence de la carte paralelle */
#define CHECK_BSCARD_PRESENT 0x0002 /* pour la verification de */
/* presence de la carte boundary */
/* scan et de son alim */
/*****************************************************************************/
/*retourne le nom du device*/
extern char *current_lpscan_device();
/*ouvre le port parallele*/
extern void open_port(int DmaBurst_size);
/*ferme le port parallele*/
extern void close_port();
/*verifie que le hardware a des caracteristiques boundary scan et/ou emul31bs et renvoie 0 si carte bs bien connectee et 0 sinon*/
extern int check_mode( );
extern int write_read_port( char* buf, unsigned int size);
#endif
/*****************************************************************************/
/******************************* END OF FILE *********************************/
/*****************************************************************************/

View File

@ -0,0 +1,205 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Francois DONNET (1998) ##*/
/*## Authors : Francois DONNET (2001) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
#include "global.h"
#include "emul31.h"
/************************************************************************/
extern FILE *emul_in; /*communication avec le emul.yac*/
Infos *InfosVbe = NULL; /*resultat final du parseur*/
/************************************************************************/
extern int emul_parse();
/************************************************************************/
/************************************************************************/
/************************************************************************/
/********** allocation memoire pour la variable globale InfosVbe *************/
/*construire la structure INSTRUCTIONS acceptees par EMUL31*/
/************************************************************************/
static Instructions *creer_INST()
{
/*bypass*/
Instructions *i0,*i1,*i2,*i3;
i0 = (Instructions*) mbkalloc(sizeof(Instructions));
i1 = (Instructions*) mbkalloc(sizeof(Instructions));
i2 = (Instructions*) mbkalloc(sizeof(Instructions));
i3 = (Instructions*) mbkalloc(sizeof(Instructions));
i0->NAME = namealloc(BYPASS_NAME);
i0->VALUE = namealloc(EMULBS_BYPASS0_VALUE);
i1->NAME = namealloc(BYPASS_NAME);
i1->VALUE = namealloc(EMULBS_BYPASS1_VALUE);
i2->NAME = namealloc(INTEST_NAME);
i2->VALUE = namealloc(EMULBS_INTEST_VALUE);
i3->NAME = namealloc(CONFIG_NAME);
i3->VALUE = namealloc(EMULBS_CONFIG_VALUE);
i0->NEXT = i1;
i1->NEXT = i2;
i2->NEXT = i3;
i3->NEXT = NULL;
return i0;
}
/************************************************************************/
/*
construire toutes les cellules des chaines BS des n EMUL31
*/
/************************************************************************/
static Cellules* creer_cellules()
{
int j;
Cellules *cell;
Cellules *last_cell = NULL;
for (j=1; j<=EMULBS_BS_SIZE; j++)
{
/*nbr de cells d'une chaine BS */
cell = (Cellules*) mbkalloc(sizeof(Cellules));
cell->NEXT = last_cell;
last_cell = cell;
cell->NAME = NULL;
/*0: pas d'inversion 1: inversion*/
cell->INVERT = 0;
/*index de la cellule qui controle*/
cell->COMMAND_CELL = NULL;
cell->COMMAND_VALUE = '1';
/*pas de court-circuit*/
cell->MODE = MODE_OUT;
}
return cell;
}
/************************************************************************/
/*creer les n EMUL31 chaines*/
/************************************************************************/
extern void creer_InfosVbe_EMULBS()
{
Infos *last_inf = NULL;
int i;
for (i=1; i<=EMULBS_NBR_EMULBS; i++) { /*faire une chaine de n EMUL31*/
InfosVbe = (Infos*)mbkalloc(sizeof(Infos));
InfosVbe->INST_SIZE = EMULBS_INST_SIZE;
/*taille du registre INSTruction de la carte EMULBS 31*/
InfosVbe->INST = creer_INST(); /*liste des INSTructions acceptees*/
InfosVbe->CELL = creer_cellules(); /*chaine boundary-scan*/
InfosVbe->BS_SIZE = EMULBS_BS_SIZE; /*longueur de la chaine*/
InfosVbe->NEXT = last_inf;
InfosVbe->BYPASS_SIZE = EMULBS_BYPASS_SIZE;
last_inf = InfosVbe;
}
}
/************************************************************************/
/* affichage de la variable globale InfosVbe*/
/************************************************************************/
extern void affich_infos()
{
Infos *inf=InfosVbe; /*variable globale cf. pcbs.h*/
Instructions *ins;
Cellules *cell;
int i=0;
while (inf!=NULL){
fprintf(stdout,"\n************************** boundary scan chain n°%d **************************\n",i++);
fprintf(stdout,"INSTruction register length=%d\t",inf->INST_SIZE);
ins=inf->INST;
while (ins!=NULL) {
fprintf(stdout,"%s(",ins->NAME);
fprintf(stdout,"\"%s\"",ins->VALUE);
fprintf(stdout,") ");
ins=ins->NEXT;
}
fprintf(stdout,"\n\n");
cell=inf->CELL;
while (cell!=NULL && cell->NAME) {
switch (cell->MODE) {
case MODE_OUT:case MODE_TRISTATE:fprintf(stdout,"out %s; ",cell->NAME);break;
case MODE_IN:fprintf(stdout,"in %s; ",cell->NAME);break;
case MODE_INOUT:fprintf(stdout,"inout %s; ",cell->NAME);break;
case MODE_COMMAND:fprintf(stdout,"command %s; ",cell->NAME);break;
}
cell=cell->NEXT;
}
fprintf(stdout,"\n");
inf=inf->NEXT;
}
fprintf(stdout,"\n");
}
/************************************************************************/
/*
charge le fichier de description de la chaine boundary scan
carte_emul--> nom fichier connexions PGA / EMULBS
*/
/************************************************************************/
extern void description_cartes(char *emul)
{
fprintf(stdout,"Loading file %s...\n", emul);
emul_in = fopen( emul, "r" );
if (!emul_in || ferror(emul_in))
{
fprintf(stderr,"Unable to load %s\n",emul);
exit(1);
}
/*creer les n EMULBS31 avec des donnees vides*/
emul_parse(); /*appel a LEX&YACC->carte_emul.yac,carte_emul.lex*/
fclose(emul_in);
}
/*****************************************************************************/
/******************************* END OF FILE *********************************/
/*****************************************************************************/

View File

@ -0,0 +1,21 @@
/*****************************************************************************/
/* charge le fichier de description de la chaine boundary scan
carte_emul--> nom fichier connexions PGA / EMULBS
*/
void description_cartes(char *emul);
/* affichage de la variable globale InfosVbe*/
void affich_infos();
/************************************************************************/
/*creer les n EMUL31 chaines*/
/************************************************************************/
extern void creer_InfosVbe_EMULBS();
/*****************************************************************************/
/******************************* END OF FILE *********************************/
/*****************************************************************************/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,32 @@
/* Structure de donnees pour les vecteurs Boundary Scan */
typedef struct Data {
char NEW_VAL;
char OLD_VAL; /* Vecteur precedent et courant */
int INDEX; /* Indexe de la cellule par rapport a la structure */
char *NAME; /* nom */
Cellules *CELL; /* de donnees informations, mode de la cellule */
/* (entree ou sortie) */
struct paevt *NEW_PAEV;
struct paevt *OLD_PAEV;
} Data;
/****************************************************************************/
/* Creation des vecteurs Boundary Scan en n sequences*/
extern void traduire(char *sce, char *destSRC, char *destBS, unsigned int sequence, unsigned int burst_size);
/****************************************************************************/
/* Envoi un vecteur Boundary Scan (TDI, TDO, TMS, TRST, TCK) sur le circuit
ou dans une structure de donnees */
/****************************************************************************/
extern struct papat *Envoi(struct papat *ppapat, char valeur[5], char *label);
/****************************************************************************\
front montant puis descendant label sur 1ere pattern
\****************************************************************************/
extern struct papat *TAP_in(struct papat *ppapat, char valeur[5], char *label);
/****************************************************************************/

View File

@ -0,0 +1,43 @@
/******************* Modes des cellules Boundary Scan ************************/
/* valeur du champ MODE */
#define MODE_IN 1 /* Entree */
#define MODE_OUT 2 /* Sortie 2 etats */
#define MODE_INOUT 3 /* Inout connector */
#define MODE_TRISTATE 4 /* Sortie 3 etats */
#define MODE_COMMAND 5 /* Controle d'une sortie 3 etats */
/****************************************************************************/
/* Liste des instructions Boundary Scan */
typedef struct Instructions {
struct Instructions *NEXT;
char *NAME; /* Nom de l'instruction */
char *VALUE; /* codes pour une instruction */
} Instructions;
/* Liste des cellules formant le registre Boundary Scan */
typedef struct Cellules {
struct Cellules *NEXT;
char *NAME; /* Nom de la cellule */
int MODE; /* INPUT, OUTPUT, TRISTATE,INOUTPUT, COMMAND */
short INVERT; /*indicateur de cellule inverseuse ou non inverseuse */
struct Cellules* COMMAND_CELL; /*cell COMMAND etablissant la valeur de commande de TRISTATE*/
char COMMAND_VALUE; /*valeur pour la mettre en haute impedance TRISTATE*/
} Cellules;
/* Structure de donnees tirees du fichier informations */
typedef struct Infos {
struct Infos *NEXT; /*pointeur sur un autre circuit Boudary Scan*/
Instructions *INST; /* Liste des instructions */
Cellules *CELL; /* Liste des cellules du registre Boundary Scan */
int INST_SIZE; /* Longueur du registre instruction */
int BYPASS_SIZE;
int BS_SIZE; /* Longueur du registre Boundary Scan*/
} Infos;
/****************************************************************************/
/******************************* END OF FILE *********************************/
/*****************************************************************************/

View File

@ -0,0 +1,225 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Philippe OLEK, Olivier SIROL (1995) ##*/
/*## Authors : Eric MECHIN (1996) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
/****************************************************************************/
#include "global.h"
/******************************Global******************************************/
int EXECUTION_ERRORS = 0;
/*****************************************************************************/
static char* p_mem = NULL; /*pointeur courant dans le block memeoire*/
static char* end_mem = NULL; /*end of block*/
static long tampon_mem = 1024; /* taille de depart des blocks = 1 Ko */
static chain_list* stack = NULL; /*liste des blocks alloues*/
/*****************************************************************************/
/*remplace tous les espaces d'un mot par des '_' ------> ne peut pas etre desallouer!! */
char *del_espace(char *s)
{
char *res,*mbk_res;
int i=0;
/*tests chaines vides*/
if (s==NULL || *s=='\0') return namealloc(s);
res=(char*) mbkalloc(strlen(s)+1);
for (i=0;i<=strlen(s);i++)
if (s[i]==' ') res[i]='_';
else res[i]=s[i];
mbk_res=namealloc(res);
mbkfree(res);
return mbk_res;
}
/*****************************************************************************/
/* compte le nombre de pattern d'un fichier PAT et retourne...
---> nombre de patterns*/
extern int Compte_file_pat( char *pat)
{
int i=0;
char c;
char *patname;
FILE *pat_in;
int not_com=2; /*il faut 2 tirets*/
patname = concatname(pat,".pat");
pat_in = fopen(patname,"r");
if ( !pat_in || ferror(pat_in) ) {
fprintf(stderr,"Unable to load %s\n",patname);
exit(1);
}
/*compter le nbr de patterns c'est compter le nombre de ':' */
while ( (c=fgetc(pat_in))!=EOF ) {
if (c=='-') not_com--;
else if (not_com==1) not_com=2;
if (c=='\n') not_com=2;
if (c==':' && not_com) i++;
}
fclose(pat_in);
return i;
}
/*****************************************************************************/
/*recoit en parametre un temps en millseconds et l'affiche avec un format */
static void affiche_time(unsigned long ms)
{
if (ms<=0) /*pas de temps suffisant*/
fprintf(stdout,"0 ms");
else if (ms<=1) /*ordre de la millisecondes*/
fprintf(stdout,"one millisecond");
else if (ms<1000) /*ordre de la millisecondes*/
fprintf(stdout,"%ld milliseconds",ms);
else if (ms<2000) /*ordre de la seconde*/
fprintf(stdout,"1.%03ld second",ms%1000);
else if (ms<60000) /*ordre de + secondes*/
fprintf(stdout,"%ld.%03ld seconds",ms/1000,ms%1000);
else if (ms<120000) /*ordre de la minute*/
fprintf(stdout,"1 minute %02ld",(ms/1000)%60);
else if (ms<3600000) /*ordre de + minutes*/
fprintf(stdout,"%ld minutes %02ld",ms/60000,(ms/1000)%60);
else if (ms<7200000) /*ordre de l'heure*/
fprintf(stdout,"1 hour %02ld",(ms/60000)%60);
else /*ordre de + heures*/
fprintf(stdout,"%ld hours %02ld",ms/3600000,(ms/60000)%60);
fflush(stdout);
}
/*****************************************************************************\
affichage des temps d'acces, de io etc...
\*****************************************************************************/
extern void statistic( unsigned long time_prg, unsigned long time_tck, unsigned long time_io, unsigned long nbr_pat )
{
/*verification*/
fprintf(stdout, "\n\n");
if (EXECUTION_ERRORS == 0)
fprintf(stdout," ----------> No error\n");
else if (EXECUTION_ERRORS == 1)
fprintf(stdout," ----------> One ERROR\n");
else fprintf(stdout," ----------> %d ERRORS\n", EXECUTION_ERRORS);
fprintf(stdout,"Global: ");
affiche_time(time_prg);
fprintf(stdout,"\nHardware: ");
affiche_time(time_tck);
fprintf(stdout," (%.1f%%)\n",time_prg?(float)((float)time_tck*100)/time_prg:0);
fprintf(stdout,"I/O: ");
affiche_time(time_io);
fprintf(stdout," (%.1f%%)\n",time_prg?(float)((float)time_io*100)/time_prg:0);
fprintf(stdout,"Patterns BS: %ld", nbr_pat);
if (time_tck==0) {
fprintf(stdout,"\n");
return;
}
/*frequence --> seuls les fronts d'horloge*/
if (time_tck!=0) time_tck=nbr_pat/(time_tck*2);
if (time_tck<1000)
fprintf(stdout," (%ld Hz)\n",time_tck);
else if (time_tck<1000000)
fprintf(stdout," (%ld.%03ld KHz)\n",time_tck/1000,time_tck%1000);
else
fprintf(stdout," (%ld.%03ld MHz)\n",
time_tck/1000000,(time_tck/1000)%1000000);
}
/****************************************************************************/
/* Visualisation de la structure de donnees */
extern int AffichePaseq( struct paseq *pat)
{
struct paiol *ppaiol;
struct papat *ppapat;
struct paevt *ppaevt;
int i = 1;
fprintf(stdout,"Paseq -> Paiol :\n");
for(ppaiol = pat -> PAIOL; ppaiol; ppaiol = ppaiol -> NEXT) {
fprintf(stdout,"\tPaiol -> name : %s\n", (char*)ppaiol -> NAME);
fprintf(stdout,"\tPaiol -> formmat : %c\n", ppaiol -> FORMAT);
fprintf(stdout,"\tPaiol -> mode : %c\n\n", ppaiol -> MODE);
}
fprintf(stdout,"Paseq -> iolnbr : %d\n", pat -> IOLNBR);
fprintf(stdout,"Appuyer sur une touche...\n");
getchar();
fprintf(stdout,"Paseq -> Papat :\n");
for(ppapat = pat -> CURPAT; ppapat; ppapat = ppapat -> NEXT) {
fprintf(stdout,"\tNumero : %d\n", i++);
fprintf(stdout,"\tPapat -> label : %s\n", (char*)ppapat -> LABEL);
fprintf(stdout,"\tPapat -> simflag : %c\n", ppapat -> SIMFLAG);
fprintf(stdout,"\tPapat -> Paevt\n");
for(ppaevt = ppapat -> PAEVT; ppaevt; ppaevt = ppaevt -> NEXT) {
fprintf(stdout,"\t\tPaevt -> index : %d\n", ppaevt -> INDEX);
fprintf(stdout,"\t\tPaevt -> usrval : %c\n", ppaevt -> USRVAL);
fprintf(stdout,"\t\tPaevt -> simval : %c\n\n", ppaevt -> SIMVAL);
}
fprintf(stdout,"Appuyer sur une touche...\n");
getchar();
fprintf(stdout,"\n");
}
fprintf(stdout,"Paseq -> errflg : %d\n", pat -> ERRFLG);
return(1);
}
/****************************************************************************/
/****************************************************************************/
extern char *block_malloc(char *s)
{
char* alloc_mem;
long taille;
if (s==NULL) return NULL;
taille = strlen(s) + 1;
if ( taille > tampon_mem ) tampon_mem = taille;
if ( p_mem+taille >= end_mem )
{
p_mem = (char*) mbkalloc( tampon_mem * sizeof(char));
end_mem = p_mem + (tampon_mem * sizeof(char));
stack = addchain( stack, p_mem );
}
alloc_mem = p_mem;
p_mem += taille;
strcpy( alloc_mem, s);
return alloc_mem;
}
/****************************************************************************/
extern void block_free()
{
chain_list *chain;
p_mem = NULL;
end_mem = NULL;
for ( chain = stack; chain; chain=chain->NEXT ) mbkfree( (char*) chain->DATA );
freechain(stack);
stack = NULL;
}
/*****************************************************************************/
/******************************* END OF FILE *********************************/
/*****************************************************************************/

View File

@ -0,0 +1,28 @@
/****************************************************************************/
/*****************************************************************************\
affichage des temps d'acces, de io etc...
\*****************************************************************************/
extern void statistic( unsigned long time_prg, unsigned long time_tck, unsigned long time_io, unsigned long nbr_pat );
/*remplace tous les espaces d'un mot par des '_' ---> ne peut etre desallouer*/
char *del_espace(char *s);
/* compte le nombre de pattern d'un fichier PAT et retourne...
---> nombre de patterns*/
extern int Compte_file_pat(char *pat);
/* Visualisation de la structure de donnees */
extern int AffichePaseq(struct paseq *pat);
/*allocation memoire des labels papat */
/*pour une sequence de patterns*/
extern char* block_malloc(char *s);
extern void block_free();
/*****************************************************************************/

View File

@ -0,0 +1,291 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Philippe OLEK, Olivier SIROL (1995) ##*/
/*## Authors : Eric MECHIN (1996) ##*/
/*## Authors : Francois DONNET (1998) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
/****************************************************************************/
#include <math.h>
#include "global.h"
/****************************************************************************/
/* Coherence entre longueurs des instructions et longueur du RI */
/****************************************************************************/
static int LgI_NbBit(Infos *inf)
{
Instructions *PInst;
for(PInst = inf->INST; PInst; PInst = PInst ->NEXT)
{
if(strlen(PInst->VALUE) > inf->INST_SIZE) {fprintf(stderr,"[BS ERROR] : the instruction length is taller than the size of instruction register!\n");return(0);}
if(strlen(PInst->VALUE) < inf->INST_SIZE) {fprintf(stderr,"[BS ERROR] : the size of instruction register is bigger than the instruction length!\n");return(0);}
}
return(1);
}
/****************************************************************************/
/* Coherence entre le nombre d'instructions et la longueur du registre
instruction */
/****************************************************************************/
static int LgI_NbI(Infos *inf)
{
Instructions *PInst;
int i = 0, NbInst = 0;
for(PInst = inf->INST; PInst; PInst = PInst ->NEXT)
i++;
NbInst = pow(2, inf->INST_SIZE);
if(NbInst < i) {
fprintf(stderr,"[BS ERROR] : there are more instruction codes than authorized by instruction register!\n");
return(0);
}
else {
return(1);
}
}
/****************************************************************************/
/* Verification de la presence de l'instruction inst dans la structure
de donnees informations
norme speciale pour le bypass="1...1" et le extest="0...0"*/
/****************************************************************************/
static int PresenceI(Infos *inf, char *inst)
{
Instructions *pinst;
for(pinst=inf->INST; pinst; pinst=pinst->NEXT)
{
if (inst==pinst->NAME) return 1;
}
fprintf(stderr,"[BS ERROR] %s : instruction is unknown!\n", (char*)inst);
return(0);
}
/****************************************************************************/
/* Verification si des instructions ont ete dupliquees au niveau des codes */
/****************************************************************************/
static int EgaliteI(Infos *inf)
{
Instructions *P1Inst, *P2Inst;
for(P1Inst = inf->INST; P1Inst; P1Inst = P1Inst ->NEXT)
for(P2Inst = P1Inst->NEXT; P2Inst; P2Inst = P2Inst ->NEXT)
if(P1Inst->VALUE==P2Inst->VALUE)
{
fprintf(stderr,"[BS ERROR] \"%s\" : duplicated code!\n", P1Inst->VALUE);
return(0);
}
return(1);
}
/****************************************************************************/
/* Coherence entre la longueur du registre Boundary Scan et le nombre de
cellules enumerees */
/****************************************************************************/
static int LgBS_NbCel(Infos *inf)
{
Cellules *PCel;
int i = 0;
for(PCel = inf->CELL; PCel; PCel = PCel ->NEXT)
i++;
if(inf->BS_SIZE > i) {
fprintf(stderr,"[BS ERROR] : tere are more BS cells than authorized!\n");
return(0);
}
else if(inf->BS_SIZE < i) {
fprintf(stderr,"[BS ERROR] : BS register is taller than the number of cells!\n");
return(0);
}
else {
return(1);
}
}
/****************************************************************************/
/* Verification si des cellules ont ete dupliquees au niveau du nom et du
mode */
/****************************************************************************/
static int EgaliteNomCel(Infos *inf)
{
Cellules *P1Cel, *P2Cel;
for(P1Cel = inf->CELL; P1Cel; P1Cel = P1Cel ->NEXT)
{
if(!P1Cel->NAME) continue;
for(P2Cel = P1Cel->NEXT; P2Cel; P2Cel = P2Cel ->NEXT)
{
if(!P2Cel->NAME) continue;
if(P2Cel->NAME == P1Cel->NAME)
{
fprintf(stderr,"[BS ERROR] %s : duplicate cell!\n", P1Cel ->NAME);
return(0);
}
}
}
return(1);
}
/****************************************************************************/
/* Les cellules de mode control commandent-elles bien les bonnes cellules ? */
/****************************************************************************/
static int CelControl(Infos *inf)
{
Cellules *P1Cel, *P2Cel;
for(P1Cel = inf->CELL; P1Cel; P1Cel = P1Cel ->NEXT)
{
if(P1Cel -> MODE == MODE_TRISTATE )
{
P2Cel = P1Cel->COMMAND_CELL;
if (!P2Cel)
{
fprintf(stderr,"[BS ERROR] : the cell named %s isn't controled by a cell!\n", P1Cel ->NAME);
return(0);
}
if(P2Cel -> MODE != MODE_COMMAND)
{
fprintf(stderr,
"[BS ERROR] : the cell named %s is controled by a cell %s wich isn't CONTROL!\n",
P1Cel ->NAME, P2Cel ->NAME);
return(0);
}
}
}
return(1);
}
/****************************************************************************/
/* Presence du nom et mode des entrees/sorties de la structure des vecteurs
paralleles dans la structure informations */
/****************************************************************************/
static int NamePaiol(struct paseq *pat)
{
struct paiol *ppaiol;
Cellules *pvbe;
Infos *inf;
int mode;
/* utilisons une propriete de namealloc() qui rend toujours le meme vecteur*/
char *tck=namealloc(TCK_NAME);
char *trst=namealloc(TRST_NAME);
char *tms=namealloc(TMS_NAME);
char *tdi=namealloc(TDI_NAME);
char *tdo=namealloc(TDO_NAME);
/*pour toutes les entrees sorties sauf l'alim. qui ne passe par la chaine BS*/
for(ppaiol = pat -> PAIOL; ppaiol; ppaiol = ppaiol -> NEXT)
{
/*fait pas partie du boundary-scan*/
if (ppaiol->NAME==tck || ppaiol->NAME==trst || ppaiol->NAME==tms
|| ppaiol->NAME==tdi || ppaiol->NAME==tdo
|| isvdd(ppaiol -> NAME) || isvss(ppaiol -> NAME)) continue;
/*signal interne*/
if(ppaiol->MODE != 'I' && ppaiol->MODE != 'O' && ppaiol->MODE != 'T') continue;
switch (ppaiol->MODE)
{
case 'I': mode = MODE_IN; break;
case 'O': mode = MODE_OUT; break;
case 'T': mode = MODE_INOUT; break;
}
/*recherche du connecteur dans la chaine boundary scan*/
for(inf=InfosVbe; inf; inf=inf->NEXT)
{
for(pvbe = inf ->CELL; pvbe; pvbe = pvbe ->NEXT)
{
if ( pvbe->NAME==ppaiol->NAME ) break;
}
if (pvbe) break;
}
if(pvbe == NULL)
{
fprintf(stderr,
"[PAT ERROR] : connector named '%s' in PAT isn't declared as a BS cell!\n",
ppaiol -> NAME);
return(0);
}
if ( pvbe->MODE != mode)
{
fprintf(stderr,
"[PAT ERROR] : not the same mode for connector '%s' between PAT and BS description!\n",
ppaiol -> NAME);
return(0);
}
}
return(1);
}
/****************************************************************************/
/* Coherences dans la structure informations */
/****************************************************************************/
extern void VerificationsInfos()
{
Infos *inf;
/*pour tous les ensembles boundary scan chaines*/
for (inf=InfosVbe;inf;inf=inf->NEXT) {
/* Coherence entre le nombre d'instructions et la longueur du registre
instruction */
if(!LgI_NbI(inf)) exit(1);
/* Coherence entre longueurs des instructions et longueur du RI */
if(!LgI_NbBit(inf)) exit(1);
/*dans tout circuit boundary scan il existe intest="?...?" */
if(!PresenceI(inf,namealloc(INTEST_NAME))) exit(1);
/*dans tout circuit boundary scan il existe bypass="1...1" */
if(!PresenceI(inf,namealloc(BYPASS_NAME))) exit(1);
/* Verification si des instructions ont ete dupliquees au niveau des codes */
if(!EgaliteI(inf)) exit(1);
/* Coherence entre la longueur du registre Boundary Scan et le nombre de
cellules enumerees */
if(!LgBS_NbCel(inf)) exit(1);
/* Verification si des cellules ont ete dupliquees au niveau du nom et du
mode */
if(!EgaliteNomCel(inf)) exit(1);
/* Les cellules de mode control commandent-elles bien les bonnes cellules ? */
if(!CelControl(inf)) exit(1);
}
}
/****************************************************************************/
/* Coherences entre structures : des vecteurs paralleles et informations */
/****************************************************************************/
extern void VerificationsPat(struct paseq *pat)
{
/* Presence du nom et mode des entrees/sorties de la structure des vecteurs
paralleles dans la structure informations */
if(!NamePaiol(pat))
{
fprintf(stderr,"Loading failed!\n");
exit(1);
}
}
/****************************************************************************/

View File

@ -0,0 +1,14 @@
#define BYPASS_NAME "Bypass"
#define INTEST_NAME "Intest"
#define CONFIG_NAME "Config"
#define EXTEST_NAME "Extest"
/****************************************************************************/
/* Controle des informations a l'interieur de la structure de donnees
informations */
extern void VerificationsInfos();
/* Controle des informations entre les structures de donnees informations et
vecteurs paralleles */
void VerificationsPat(struct paseq *pat);
/****************************************************************************/

View File

@ -0,0 +1,13 @@
##
## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems
## (C) 1995, MASI, CAO-VLSI Team
##
## Authors : Philippe OLEK, Olivier SIROL
## (Projet Maitrise EEA)
## Initial Revision : April 1995
## Revision : June 1995
##
## E-mail support: cao-vlsi@masi.ibp.fr
##
bool 'Boundary-scan access via parallel printer port' CONFIG_LPSCAN

View File

@ -0,0 +1,178 @@
------------------------------------------------------
Comment installer le driver lpscan dans un noyau Linux
------------------------------------------------------
(c) 1997 Olivier Florent, d'apres le rapport de stage de Maitrise EEA,
de Juin 95 par Olivier Sirol et Philippe Olek
2001 Francois Donnet version pour Linux 2.1 et plus
REMARQUES :
-----------
i/ Version du noyau utilisee : 2.2.10 et 2.4.9-21
ii/ On suppose que le lecteur sait compiler un noyau Linux
iii/ Il faut bien sur les droits 'root' pour compiler un noyau
Marche a suivre :
-----------------
0/ Creer un repertoire /usr/src/linux/drivers/lpscan
1/ Recopier les fichiers lpscan/lpscan.c
lpscan/lpscan.h
lpscan/Makefile
lpscan/Config.in
dans ce repertoire
2/ Creer un device /dev/lpscan0 :
2.1/ Choisir un MAJOR number libre en lisant le fichier
/usr/src/linux/Documentation/devices.txt
Actuellement (2.2.10), '60' est un MAJOR number libre.
2.2/ Creer le device de type char :
mknod /dev/lpscan0 c 60 0
2.3/ Donner les droits en lecture et ecriture a tout le monde :
chmod a+rwx /dev/lpscan0
2.4/ Modifier /usr/src/linux/drivers/lpscan/lpscan.h pour mettre le
MAJOR number choisi :
#define MAJOR_LPSCAN 60
3/ Modifier le Makefile /usr/src/linux/drivers/Makefile en rajoutant :
3.1/ ligne 12 dans le noyau 2.2.10
ajouter 'lpscan' dans la liste 'ALL_SUB_DIRS := $(SUB_DIRS) ...'
noyau 2.4.9
ajouter 'lpscan' dans la liste 'mod_subdirs := ...'
3.2/ Les 4 lignes suivantes :
noyau 2.2.10
# Ajout du driver lpscan
ifdef CONFIG_LPSCAN
SUB_DIRS += lpscan
endif
noyau 2.4.9
# Ajout du driver lpscan
ifdef CONFIG_LPSCAN
subdir-$(CONFIG_LPSCAN) += lpscan
endif
4/ Modifier le Makefile /usr/src/linux/Makefile en rajoutant :
4.1/ Les 4 lignes suivantes :
noyau 2.2.10
# Ajout du driver lpscan
ifdef CONFIG_LPSCAN
DRIVERS := $(DRIVERS) drivers/lpscan/lpscan.a
endif
noyau 2.4.9
# Ajout du driver lpscan
ifdef CONFIG_LPSCAN
DRIVERS-$(CONFIG_LPSCAN) += drivers/lpscan/lpscan.a
endif
5/ Modifier le fichier /usr/src/linux/drivers/char/mem.c
5.1/ Rajouter dans les declarations de fonctions les 3 lignes suivantes :
#ifdef CONFIG_LPSCAN
extern void lpscan_init(void);
#endif
5.2/ Rajouter dans la fonction chr_dev_init() avant le return les 3 lignes
suivantes :
#ifdef CONFIG_LPSCAN
lpscan_init();
#endif
6/ Rajouter a la fin du fichier /usr/src/linux/arch/i386/config.in les lignes
suivantes :
mainmenu_option next_comment
comment 'LPSCAN support'
source drivers/lpscan/Config.in
endmenu
6/ definir la variable d'environement CONFIG_LPSCAN
7/ faire un make xconfig dans le repertoire linux,
et cliquer sur le bouton CONFIG_LPSCAN et selectionner 'y' puis save & exit
ou bien faire un make config dans le repertoire linux,
et repondre 'Y' a CONFIG_LPSCAN
8/ faire un make depend
9/ faire un make bzImage (... et aller prendre un cafe !!)
10/ Copier l'image du noyau compresse sur la racine avec un nom approprie. Par
exemple :
cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-2.4.9+lpscan
11/ Rajouter une entree pour ce noyau dans /etc/lilo.conf. Par exemple :
# Linux bootable partition config begins
image = /boot/vmlinuz-2.4.9+lpscan
root = /dev/hda2
label = lpscan
read-only
# Linux bootable partition config ends
12/ faire 'lilo'. On doit voir apparaitre une ligne 'lpscan' dans les noyaux
installes.
13/ Arreter le systeme, brancher la carte Boundary-Scan, rebooter en
choisissant le bon noyau (lpscan) au boot
14/ On doit apercevoir le message suivant au boot
lpscan_init: Driver LPSCAN carte parallele OK ########################
lpscan_init: Carte parallele presente
15/ Si on possede un chip avec boundary-scan sur la carte, on peut faire
'pcbs -check' qui extrait du chip ses caracteristiques BS. Exemple avec
l'amd2901 :
[14:40] testools@jaques 79> pcbs -check
@@@@@@@ @@@@@@@
@@ @@ @@ @@
@@ @@ @@ @@
@@ @@ @@@ @@ @@ @@@@@@
@@ @@ @@ @@ @@ @@ @@ @
@@@@@ @@ @ @@@@@@ @@@
@@ @@ @@ @@ @@@@
@@ @@ @@ @@ @@@@
@@ @@ @ @@ @@ @ @@@
@@ @@ @@ @@ @@ @@ @@
@@@@@@ @@@ @@@@@@@@ @ @@@@@
PC/Boundary-Scan Tester Platform
Alliance CAD System 3.0, pcbs 1.0a
Copyright (c) 1997, MASI, CAO-VLSI Team
E-mail support: cao-vlsi@masi.ibp.fr
Checking DUT connected to /dev/lpscan0
INSTRUCTION Register seems to be 3 bits long
BYPASS register seems to be 1 bits long
BOUNDARY-SCAN register seems to be 46 bits long
16/ ................ It's OK !

View File

@ -0,0 +1,33 @@
#
# Makefile for the linux kernel.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definitions are now in the main makefile...
##
## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems
## (C) 1995, MASI, CAO-VLSI Team
##
## Authors : Philippe OLEK, Olivier SIROL, Francois Donnet
## (Projet Maitrise EEA)
## Initial Revision : April 1995
## Revision : June 1995
## Revision : Febr 2002
##
## E-mail support: cao-vlsi@masi.ibp.fr
##
# noyau 2.4.9-21
obj-$(CONFIG_LPSCAN) := lpscan.o
# noyau 2.2.10
L_OBJS := lpscan.o
#target
L_TARGET := lpscan.a
include $(TOPDIR)/Rules.make

View File

@ -0,0 +1,401 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Philippe OLEK, Olivier SIROL (1995) ##*/
/*## Authors : Eric MECHIN (1996) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
/*####==============================================================####*/
/*## ##*/
/*## lpscan.c : Driver pour port parallele architecture PC/Linux ##*/
/*## NOYAU - driver caractere ##*/
/*## ##*/
/*## 13/12/99 F.Dromard. Modification pour Linux 2.0 et plus. ##*/
/*## La routine init n'a plus de parametre et ne ##*/
/*## renvoie rien. (correction de 1996 non reportee) ##*/
/*## 09/04/01 1/ F.Donnet Modification pour Linux 2.1 et plus. ##*/
/*## les fonction memcpy_{to,from}fs sont remplacees ##*/
/*## par copy_{to,from}_user ##*/
/*## 2/ segment.h n'existe plus et est remplace par ##*/
/*## uaccess.h pour Linux 2.1 et plus ##*/
/*## 3/ la structure file_operations a changee ainsi que ##*/
/*## les prototype des fonctions read et write ##*/
/*## 15/02/02 1/ F. Donnet pour la version 2.4.9-21 ##*/
/*## la structure file_operations a changee ##*/
/*####==============================================================####*/
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/utsname.h>
/* #include <asm/segment.h> */
#include <asm/uaccess.h>
#include <asm/irq.h>
#include <asm/io.h>
#if 0
#include <sys/ioctl.h>
#endif
#include "lpscan.h"
#define memcpy_tofs(a,b,c) copy_to_user((a),(b),(c))
#define memcpy_fromfs(a,b,c) copy_from_user((a),(b),(c))
/*========================================================================
function decls
*/
#if 0
static int lpscan_read(struct inode * inode,struct file * file,char * buf,int count);
static int lpscan_write(struct inode * inode,struct file * file,char * buf,int count);
static void lpscan_release(struct inode * inode, struct file * file);
#endif
void lpscan_init(void);
static int lpscan_open(struct inode * inode, struct file * file);
static ssize_t lpscan_read(struct file * file,char * buf,size_t count,loff_t *off);
static ssize_t lpscan_write(struct file * file,const char * buf,size_t count,loff_t *off);
static int lpscan_ioctl(struct inode * inode,struct file * file,unsigned int cmd,unsigned long arg);
static int lpscan_release(struct inode * inode, struct file * file);
/*========================================================================
variables globales, gestion d'un seul port parallele
*/
typedef struct { /* struct pour dev (choix personnel) */
char bR[MAX_BUF]; /* buffer en reception */
char bW[MAX_BUF]; /* buffer en emission */
char iocard; /* 1 : carte paral presente */
char inUse; /* mis a 0 par init, a IN_USE par open, a 0 par close */
/* empeche l'utilisation du port par plusieurs process */
/* a la fois */
} Vglob;
Vglob lpscan;
typedef struct { /* struct pour un arg ioctl (choix personnel) */
char * buf; /* buffer */
int count; /* sa taille */
} ioctlarg;
#if 0 /*noyau 2.0*/
static struct file_operations lpscan_fops = { /* struct imposee */
NULL, /* seek */
lpscan_read, /* read */
lpscan_write, /* write */
NULL, /* readdir */
NULL, /* select */
lpscan_ioctl, /* ioctl */
NULL, /* mmap */
lpscan_open, /* open */
lpscan_release /* release */
};
#endif
#if 0 /*noyau 2.2.10*/
static struct file_operations lpscan_fops = { /* struct imposee */
NULL, /* loff_t (*llseek) (struct file *, loff_t, int); */
lpscan_read, /* ssize_t (*read) (struct file *, char *, size_t, loff_t *); */
lpscan_write, /* ssize_t (*write) (struct file *, const char *, size_t, loff_t *); */
NULL, /* int (*readdir) (struct file *, void *, filldir_t); */
NULL, /* unsigned int (*poll) (struct file *, struct poll_table_struct *); */
lpscan_ioctl, /* int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long); */
NULL, /* int (*mmap) (struct file *, struct vm_area_struct *); */
lpscan_open, /* int (*open) (struct inode *, struct file *); */
NULL, /* int (*flush) (struct file *); */
lpscan_release, /* int (*release) (struct inode *, struct file *); */
NULL, /* int (*fsync) (struct file *, struct dentry *); */
NULL, /* int (*fasync) (int, struct file *, int); */
NULL, /* int (*check_media_change) (kdev_t dev); */
NULL, /* int (*revalidate) (kdev_t dev); */
NULL, /* int (*lock) (struct file *, int, struct file_lock *); */
};
#endif
/*noyau 2.4.9-21*/
static struct file_operations lpscan_fops = { /* struct imposee */
NULL, /* struct module *owner; */
NULL, /* loff_t (*llseek) (struct file *, loff_t, int); */
lpscan_read, /* ssize_t (*read) (struct file *, char *, size_t, loff_t *); */
lpscan_write, /* ssize_t (*write) (struct file *, const char *, size_t, loff_t *); */
NULL, /* int (*readdir) (struct file *, void *, filldir_t); */
NULL, /* unsigned int (*poll) (struct file *, struct poll_table_struct *); */
lpscan_ioctl, /* int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long); */
NULL, /* int (*mmap) (struct file *, struct vm_area_struct *); */
lpscan_open, /* int (*open) (struct inode *, struct file *); */
NULL, /* int (*flush) (struct file *); */
lpscan_release, /* int (*release) (struct inode *, struct file *); */
NULL, /* int (*fsync) (struct file *, struct dentry *); */
NULL, /* int (*fasync) (int, struct file *, int); */
NULL, /* int (*check_media_change) (kdev_t dev); */
NULL, /* int (*revalidate) (kdev_t dev); */
NULL, /* int (*lock) (struct file *, int, struct file_lock *); */
};
/*========================================================================
Routines Driver
*/
/*========================================================================
INIT
*/
void lpscan_init(void)
{
lpscan.inUse = 0; /* initialise a 0 */
if (register_chrdev(MAJOR_LPSCAN,"lpscan",&lpscan_fops))
{
printk("lpscan_init: Unable to get major %d for Driver LPSCAN\n",MAJOR_LPSCAN);
return ;
}
else {
printk("lpscan_init: Driver LPSCAN carte parallele OK ########################\n");
}
/* on ecrit 0 sur le port parallele (DATA reg) puis on le relit */
/* pour verifier qu'il est present */
outb(0x00,DATA);
if (inb(DATA) == 0)
{
lpscan.iocard=1;
printk("lpscan_init: Carte parallele presente\n");
}
else
{
lpscan.iocard=0;
printk("lpscan_init: Carte parallele absente\n");
}
return ;
}
/*========================================================================
OPEN
*/
static int lpscan_open(struct inode * inode, struct file * file)
{
int minor =MINOR(inode->i_rdev);
#ifdef DEBUG
printk("Driver_LPSCAN : open lpscan%x\n",minor);
#endif
if ((minor) != 0)
{
#ifdef DEBUG
printk("Driver_LPSCAN : mauvais minor\n");
#endif
return -EINVAL; /* invalid argument */
}
if (lpscan.inUse)
{
#ifdef DEBUG
printk("Driver_LPSCAN : port utilise par un autre process\n");
#endif
return -EBUSY; /* device busy */
}
lpscan.inUse = IN_USE;
return 0; /* no error */
}
/*========================================================================
READ
*/
#if 0
static int lpscan_read(struct inode * inode,struct file * file,char * buf,int count)
{
#ifdef DEBUG
int minor =MINOR(inode->i_rdev);
printk("Driver_LPSCAN : read lpscan%x\n",minor);
#endif
if (count != 1)
return -EINVAL; /* invalid argument (read de 1 octet seulement) */
lpscan.bR[0] = inb(STATUS); /* Renvoie le contenu du registre STATUS */
memcpy_tofs(buf,&lpscan.bR[0],count); /* noyau -> utilisateur */
#ifdef DEBUG
printk("Driver_LPSCAN : fin read\n");
#endif
return 0; /* pas d'erreur */
}
#endif
static ssize_t lpscan_read(struct file * file,char * buf,size_t count, loff_t *off)
{
if (count != 1)
return -EINVAL; /* invalid argument (read de 1 octet seulement) */
lpscan.bR[0] = inb(STATUS); /* Renvoie le contenu du registre STATUS */
memcpy_tofs(buf,&lpscan.bR[0],count); /* noyau -> utilisateur */
#ifdef DEBUG
printk("Driver_LPSCAN : fin read\n");
#endif
return count; /* pas d'erreur */
}
/*========================================================================
WRITE
*/
#if 0
static int lpscan_write(struct inode * inode,struct file * file,char * buf,int count)
{
#ifdef DEBUG
int minor =MINOR(inode->i_rdev);
printk("Driver_LPSCAN : write lpscan%x\n",minor);
#endif
if (count != 1)
return -EINVAL; /* invalid argument (write de 1 octet seulement) */
memcpy_fromfs(&lpscan.bW[0],buf,count); /* utilisateur -> noyau */
outb(lpscan.bW[0],DATA); /* Ecrit l'octet dans le registre DATA */
#ifdef DEBUG
printk("Driver_LPSCAN : fin write\n");
#endif
return 0; /* pas d'erreur */
}
#endif
static ssize_t lpscan_write(struct file * file,const char * buf,size_t count, loff_t *off)
{
if (count != 1)
return -EINVAL; /* invalid argument (write de 1 octet seulement) */
memcpy_fromfs(&lpscan.bW[0],buf,count); /* utilisateur -> noyau */
outb(lpscan.bW[0],DATA); /* Ecrit l'octet dans le registre DATA */
#ifdef DEBUG
printk("Driver_LPSCAN : fin write\n");
#endif
return count; /* pas d'erreur */
}
/*========================================================================
IOCTL
*/
static int lpscan_ioctl(struct inode * inode,struct file * file,unsigned int cmd,unsigned long arg)
{
int i;
#ifdef DEBUG
int minor =MINOR(inode->i_rdev);
printk("Driver_LPSCAN : ioctl lpscan%x, cmd %x\n",minor,cmd);
#endif
switch (cmd)
{
/*========================================================================
IOCTL CHECK_CARD_PRESENT
*/
case CHECK_CARD_PRESENT :
/* carte parallele est presente : 1 sinon 0 */
return lpscan.iocard; /* cf init */
break;
/*========================================================================
IOCTL CHECK_BSCARD_PRESENT
*/
case CHECK_BSCARD_PRESENT :
/* STROBE au 5V de la carte BS
AUTOFEED a la masse de la carte BS via 150 Ohms
methode valide si carte controller rescente ...
attention court-circuit sinon ?
on ecrit 01 sur le port parallele (CONTROL reg) puis on le relit
01 : Carte Boundary Scan absente!
11 : Carte Boundary Scan mal alimentee !!
10 : Carte Boundary Scan OK */
outb(0x01,CONTROL);
return((int)inb(CONTROL) & 3); /* on garde STROBE et AUTOFEED */
break;
/*========================================================================
IOCTL GET_TDO_BUFFERED
*/
case GET_TDO_BUFFERED : /* non utilisee */
/* implementation de la fonction utilisateur getTDO */
if (!arg)
return -EINVAL; /* need pointer */
if (((ioctlarg * )arg)->count > MAX_BUF)
return -EINVAL; /* invalid argument (MAX_BUF octets seulement) */
memcpy_fromfs(&lpscan.bW[0],((ioctlarg * )arg)->buf,((ioctlarg * )arg)->count); /* utilisateur -> noyau */
for (i=0;i < (((ioctlarg * )arg)->count) ; i++)
{
outb(lpscan.bW[i],DATA); /* Ecrit l'octet dans le registre DATA */
lpscan.bR[i] = inb(STATUS); /* Renvoie le contenu du registre STATUS */
#ifdef DEBUG
printk("Driver_LPSCAN : done one GET_TDO_BUFFERED\n");
#endif
}
memcpy_tofs(((ioctlarg * )arg)->buf,&lpscan.bR[0],((ioctlarg * )arg)->count); /* noyau -> utilisateur */
return 0; /* pas d'erreur */
break;
/*========================================================================
IOCTL default
*/
default :
return -EINVAL; /* Invalid argument */
break;
}
return 0;
}
/*========================================================================
RELEASE
*/
#if 0
static void lpscan_release(struct inode * inode, struct file * file)
{
#ifdef DEBUG
int minor =MINOR(inode->i_rdev);
printk("Driver_LPSCAN : release lpscan%x\n",minor);
#endif
lpscan.inUse = 0; /* libere le port */
}
#endif
static int lpscan_release(struct inode * inode, struct file * file)
{
#ifdef DEBUG
int minor =MINOR(inode->i_rdev);
printk("Driver_LPSCAN : release lpscan%x\n",minor);
#endif
lpscan.inUse = 0; /* libere le port */
return 0;
}
/* End of lpscan.c ======================================================*/

View File

@ -0,0 +1,99 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Philippe OLEK, Olivier SIROL ##*/
/*## (Projet Maitrise EEA) ##*/
/*## Initial Revision : April 1995 ##*/
/*## Revision : June 1995 ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
/*####==============================================================####*/
/*## ##*/
/*## lpscan.h : Driver pour port parallele architecture PC/Linux ##*/
/*## Include file ##*/
/*## ##*/
/*####==============================================================####*/
#ifndef _DRVCPARAL_
#define _DRVCPARAL_
#define MAJOR_LPSCAN 60
#define IN_USE 1 /* port utilise? */
#define MAX_BUF 256 /* buffer pour xfer (non utilise) */
/* adresses physiques du port parallele */
#define Base_Adr 0x378 /* LPT1 : 0x378 */
/* LPT2 : 0x278 */
/* LPT3 : 0x3BC (a verifier) */
/* LPT4 : 0x??? (suivant pc) */
#define DATA Base_Adr /* registre DATA, en ecriture */
/* (OUT) only on most cards */
#define STATUS Base_Adr+1 /* registre de STATUS, en lecture */
/* (IN) */
#define CONTROL Base_Adr+2 /* registre de CONTROLE, lecture, ecriture */
/* (IN/OUT) */
/* DATA REGISTER : OUT */
/* bits du registre de donnees de la carte */
#define DATA0 0x01 /* DATA bit 0 */
#define DATA1 0x02 /* DATA bit 1 */
#define DATA2 0x04 /* DATA bit 2 */
#define DATA3 0x08 /* DATA bit 3 */
#define DATA4 0x10 /* DATA bit 4 */
#define DATA5 0x20 /* DATA bit 5 */
#define DATA6 0x40 /* DATA bit 6 */
#define DATA7 0x80 /* DATA bit 7 */
/* STATUS REGISTER : IN */
/* bits du registre d'etat de la carte */
/* STATUS bits 0,1,2 sont non definis */
/* (peut etre a 0 sur certains pc) */
#define ERROR 0x08 /* STATUS bit 3 */
#define SELECT 0x10 /* STATUS bit 4 */
#define PE 0x20 /* STATUS bit 5 */
#define ACK 0x40 /* STATUS bit 6 */
#define BUSY 0x80 /* STATUS bit 7 !!!barre */
/* CONTROL REGISTER : IN/OUT */
/* bits du registre de controle de la carte */
/* CONTROL bits 5,6,7 sont non definis */
#define STROBE 0x01 /* CONTROL bit 0 !!!barre */
#define AUTOFEED 0x02 /* CONTROL bit 1 !!!barre */
#define INIT 0x04 /* CONTROL bit 2 */
#define SELECT_IN 0x08 /* CONTROL bit 3 !!!barre */
#define IRQ_ENABLE 0x10 /* CONTROL bit 4 */
/* Si IRQ_ENABLE=1 alors une IRQ7 est generee lorsque ACK passe a 0 */
/* IRQ_ENABLE ne sort pas sur la DB25 */
/* !!!barre signifie lecture et/ou ecriture de la valeur complementee */
/* commandes IOCTL du driver */
#define CHECK_CARD_PRESENT 0x0001 /* pour la verification de */
/* presence de la carte parallele */
#define CHECK_BSCARD_PRESENT 0x0002 /* pour la verification de */
/* presence de la carte boundary */
/* scan et de son alim */
#define GET_TDO_BUFFERED 0x0003 /* implementation de la fonction */
/* utilisateur getTDO dans le */
/* driver */
#endif

View File

@ -0,0 +1,126 @@
include $(ALLIANCE_TOP)/etc/$(ALLIANCE_OS).mk
include $(ALLIANCE_TOP)/etc/libraries.mk
###############################################################################
SCE = pcbs.c util.c bstools.c infos.c verif.c traduction.c sig.c parseur.c emul_yac.c emul_lex.c pga_yac.c pga_lex.c
OBJ = pcbs.o util.o bstools.o infos.o verif.o traduction.o sig.o parseur.o emul_yac.o emul_lex.o pga_yac.o pga_lex.o
HEADERS = pcbs.h util.h bstools.h infos.h verif.h traduction.h sig.h parseur.h emul_yac.h pga_yac.h emul31.h type_infos.h global.h
DEBUG = -g -Wall
CFLAGS = $(ALC_INC) -D$(ALLIANCE_OS) $(DEBUG)
YACC = yacc
#PROFILE = -pg
#PURIFY = purify -logfile=pure.log
########################PARAMETRES DU PROGRAMME################################
EXE = pcbs
VERSION = 2.1
PGA_SIZE = 17
NBR_EMULBS31 = 4
###############################################################################
#bibliotheque ALLIANCE modifiee
BVL_H = bvl999.h
BVL_L = -lBvl999
BVL_INCLUDE = ../bvl
BVL_LIB = ../bvl
ALC_INC = -DPGA_SIZE=$(PGA_SIZE) \
-DNBR_EMUL=$(NBR_EMULBS31) \
-DPROGRAM_NAME='"$(EXE)"' \
-DPROGRAM_VERSION='"$(VERSION)"' \
-DALLIANCE_VERSION=$(ALLIANCE_VERSION) \
-I$(ALLIANCE_INCLUDE) \
-DMLU_H='<$(MLU_H)>' \
-I$(BVL_INCLUDE) \
-DBVL_H='"$(BVL_H)"' \
-DMLO_H='<$(MLO_H)>' \
-DBHL_H='<$(BHL_H)>' \
-DBEH_H='<$(BEH_H)>' \
-DPPT_H='<$(PPT_H)>' \
-DPAT_H='<$(PAT_H)>' \
-DPHL_H='<$(PHL_H)>' \
-DLOG_H='<$(LOG_H)>' \
-DMUT_H='<$(MUT_H)>'
ALC_LIB = -L$(BVL_LIB) \
$(BVL_L) \
-L$(ALLIANCE_LIB) \
$(MLO_L) \
$(BHL_L) \
$(BEH_L) \
$(PPT_L) \
$(PHL_L) \
$(PAT_L) \
$(LOG_L) \
$(MUT_L)
##+++++++++++++++++++++++++++++++les regles++++++++++++++++++++++++++++++++++##
$(TARGET_BIN)/$(EXE) : $(OBJ)
@echo -n "Generation de l'executable ($@)...."
$(PURIFY) $(CC) $(PROFILE) -o $@ $(OBJ) $(ALC_LIB)
@echo "That's it !!"
.c.o :
@echo "Compilation de $< (options : '$(DEBUG)')"
$(CC) -c $(CFLAGS) $<
%.i : %.c
@echo "Preprocessing de $<"
$(CC) -E $(CFLAGS) $< > $@
##+++++++++++++++++++++++++++++++LEX&YACC++++++++++++++++++++++++++++++++++++##
emul_yac.c: emul.yac
${YACC} -d emul.yac
@sed -e "s/yy/emul_/g" -e "s/YY/EMUL_/g" y.tab.c > emul_yac.c
@sed -e "s/yy/emul_/g" -e "s/YY/EMUL_/g" y.tab.h > emul_yac.h
@rm y.tab.c y.tab.h
pga_yac.c: pga.yac
${YACC} -d pga.yac
@sed -e "s/yy/pga_/g" -e "s/YY/PGA_/g" y.tab.c > pga_yac.c
@sed -e "s/yy/pga_/g" -e "s/YY/PGA_/g" y.tab.h > pga_yac.h
@rm y.tab.c y.tab.h
## sed remplace les noms globaux commencant par yy pour que deux parseurs cohabitent dans le meme programme
emul_lex.c: lexeur.lex
${LEX} ${LEXFLAGS} lexeur.lex
@sed -e "s/yy/emul_/g" -e "s/YY/EMUL_/g" lex.yy.c > emul_lex.c
pga_lex.c: lexeur.lex
@sed -e "s/yy/pga_/g" -e "s/YY/PGA_/g" lex.yy.c > pga_lex.c
@rm lex.yy.c
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
clean:
-/bin/rm -f *.o
-/bin/rm -f $(TARGET_BIN)/$(EXE)
-/bin/rm -f *~ core
-/bin/rm -f pga_yac.c emul_yac.c pga_lex.c emul_lex.c
## le tiret devant la commande signifie que **error 1** est ignore
depend :
@echo "Computing depends into Makefile.new"
sed '/^#DO NOT DELETE/q' Makefile > Makefile.new
$(CC) -M $(SCE) $(ALC_INC) >> Makefile.new
@echo "Moving Makefile to Makefile.bak"
rm -f Makefile.bak
-mv Makefile Makefile.bak
@echo "Moving Makefile.new to Makefile"
-mv Makefile.new Makefile
headers :
@echo "Generation automatique des Headers"
for file in $(HEADERS) ; \
do sed '/\/\* PUBLIC FONCTIONS \*\//q' \$file:r.h > tmp.h ; \
grep EXTERN \$file:r.c | sed -e 's/EXTERN \(.*\)(.*)/extern \1();/' >> tmp.h ; \
cat tmp.h \;
done
###############################################################################
###############################################################################
###############################################################################
#DO NOT DELETE

View File

@ -0,0 +1,49 @@
## Process this file with automake to produce Makefile.in
YACC = @YACC@ -d
DEFS = @DEFS@ -DPCBS_PGA_SIZE=17 -DPCBS_NBR_EMULBS=4 -DPCBS_VERSION=\"@PCBS_VERSION@\" -DPROGRAM_NAME=\"pcbs\"
AM_CFLAGS = @ALLIANCE_CFLAGS@
bin_PROGRAMS = pcbs
CLEANFILES = emul_y.c emul_y.h pga_y.c pga_y.h pga_l.c emul_l.c y.tab.c y.tab.h
INCLUDES = -I$(top_builddir)/src/pcbs -I$(top_srcdir)/src/bvl
pcbs_LDADD = \
-L$(top_builddir)/src/bvl -lBvl \
@ALLIANCE_LIBS@ \
-lMpu \
-lMlu \
-lMlo \
-lBhl \
-lBeh \
-lPpt \
-lPhl \
-lPat \
-lLog \
-lMut
pcbs_SOURCES = emul_y.y pga_y.c emul_l.c pga_l.c \
bstools.c parseur.c \
traduction.c verif.c \
infos.c pcbs.c sig.c util.c \
bstools.h global.h pcbs.h traduction.h \
verif.h emul31.h infos.h \
type_infos.h parseur.h sig.h util.h
emul_y.c emul_y.h : $(srcdir)/emul_y.y
$(YACC) $(YFLAGS) $(srcdir)/emul_y.y && sed -e "s/yy/emul_/g" -e "s/YY/EMUL_/g" y.tab.c > emul_y.c && sed -e "s/yy/emul_/g" -e "s/YY/EMUL_/g" y.tab.h > emul_y.h
pga_y.c pga_y.h : $(srcdir)/pga_y.y
$(YACC) $(YFLAGS) $(srcdir)/pga_y.y && sed -e "s/yy/pga_/g" -e "s/YY/PGA_/g" y.tab.c > pga_y.c && sed -e "s/yy/pga_/g" -e "s/YY/PGA_/g" y.tab.h > pga_y.h
emul_l.c : $(srcdir)/lexeur_l.l emul_y.h
$(LEX) -t $(srcdir)/lexeur_l.l | sed -e "s/yy/emul_/g" -e "s/YY/EMUL_/g" > emul_l.c
pga_l.c : $(srcdir)/lexeur_l.l pga_y.h
$(LEX) -t $(srcdir)/lexeur_l.l | sed -e "s/yy/pga_/g" -e "s/YY/PGA_/g" > pga_l.c

View File

@ -0,0 +1,845 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Philippe OLEK, Olivier SIROL (1995) ##*/
/*## Authors : Eric MECHIN (1996) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
/* POUR LE DEBUG */
#undef DUMMY
#include "global.h"
/* FUNCTION DECL *******************************************************/
static void checkLPT();
static void outout();
static char inin();
static void reset_bs();
static int verif_io();
/* send a pattern ("0110") ordre TDI TMS TRST TCK */
static void sendTAP();
/* send a pattern ("0110") and return TDO = 1 or 0 */
static char getTDO();
/* GLOBAL VARS **********************************************************/
static char hostname[256];
/* file descriptor of lpscan dev */
static int fd;
/* check BS i/o in .pat file */
static int table_index[5];
static int flag_TRST;
/*nombre de patterns BS deja envoyees*/
static unsigned int BSpat=0;
/*****************************************************************************/
char *current_lpscan_device()
{
#ifdef DUMMY
return "/dev/null" ;
#else
return "/dev/lpscan0";
#endif
}
/*****************************************************************************/
/* FONTIONS SE SERVANT DU DRIVER LPSCAN *********************************/
/* elles exit(LPSCAN_ERROR) toutes sauf close_port en cas d'erreur */
/***************************************/
/* fonction d ouverture du port // */
/***************************************/
char PORT_ALREADY_OPENED = FALSE ;
#define NOMBRE_ESSAI_MAX 3
#define MAX_WAIT 10000
void open_port() {
int erreur;
int nombre_essai;
int wait;
nombre_essai = 0;
fd = open(current_lpscan_device(), O_RDWR) ;
/* On va essayer d'attendre si c'est occupe */
while ((errno == EBUSY) && (fd < 0)) {
if (nombre_essai > NOMBRE_ESSAI_MAX)
break;
wait = 0 ;
while (wait < MAX_WAIT)
wait++;
fprintf(stderr,"%s device is busy. Trying again ...\n",PROGRAM_NAME);
fd = open(current_lpscan_device(), O_RDWR) ;
nombre_essai++;
}
if ( fd < 0 ) {
erreur = errno;
perror("Error opening " PROGRAM_NAME " device");
switch (erreur) {
case EBUSY : fprintf(stderr,"%s device is currently in use. Please try later\n",PROGRAM_NAME);
pcbs_exit(LPSCAN_ERROR);
break;
default :
gethostname(hostname,255);
fprintf(stderr,"Cannot find Boundary-scan Card on this machine (%s)\n"
,hostname);
}
pcbs_exit(LPSCAN_ERROR);
}
PORT_ALREADY_OPENED = TRUE;
checkLPT(); /* carte parallele OK ? */
reset_bs(); /* reset du BS du circuit */
}
/*****************************************************************************/
/***************************************/
/* fonction de fermeture du port // */
/***************************************/
void close_port() {
if (PORT_ALREADY_OPENED == FALSE)
return ;
reset_bs(); /* reset du BS du circuit */
if (close(fd) < 0) { /* fermeture du port // */
fprintf(stderr, "#### ");
perror("Error closing " PROGRAM_NAME " device");
pcbs_exit(-1);
}
PORT_ALREADY_OPENED = FALSE;
}
/*****************************************************************************/
/***************************************/
/* fonction ecriture du port // */
/***************************************/
static void outout(what)
int what;
{
char value;
value = what;
if(write(fd, &value, 1) < 0) {
fprintf(stderr, "#### ");
perror("Error writing " PROGRAM_NAME " device");
close_port();
pcbs_exit(LPSCAN_ERROR);
}
}
/*****************************************************************************/
/***********************************/
/* fonction lecture du port // */
/***********************************/
static char inin() {
char value = 0;
if(read(fd, &value, 1) < 0) {
fprintf(stderr, "#### ");
perror("Error reading " PROGRAM_NAME " device");
pcbs_exit(LPSCAN_ERROR);
}
return((value & SELECT) != 0);
}
/*****************************************************************************/
/************************************************/
/* fonction de verification de presence LPT1 */
/************************************************/
static void checkLPT() {
int res;
#ifndef DUMMY
if ((res = (ioctl(fd, CHECK_CARD_PRESENT, NULL))) < 0) {
fprintf(stderr, "#### ");
perror("Error accessing " PROGRAM_NAME " device (ioctl)");
pcbs_exit(LPSCAN_ERROR);
}
if (res != 1) {
gethostname(hostname,255);
fprintf(stderr, "Cannot find Boundary-scan Card on this machine (%s)\n",
hostname);
pcbs_exit(LPSCAN_ERROR);
}
#endif
}
/*****************************************************************************/
/*****************************************/
/* send a pattern (eg:"0110") to the TAP */
/* ordre TDI TMS TRST TCK */
/*****************************************/
static void sendTAP(vecteur)
char *vecteur;
{
outout(abintoi(vecteur));
}
/*****************************************************************************/
/**************************************************/
/* fonction d'envoie du vecteur */
/* send a pattern ("0110") and return TDO= + or - */
/**************************************************/
char getsimval(vecteur)
char *vecteur;
{
sendTAP(vecteur); /*vecteur = TDI, TMS, TRST, TCK, '\0'*/
return ((inin() > 0) ? '+' : '-'); /* TDO = + ou - */
}
/*****************************************************************************/
/**************************************************/
/* send a pattern ("0110") and return TDO= 1 or 0 */
/**************************************************/
static char getTDO(vecteur)
char *vecteur;
{
sendTAP(vecteur);
return (inin()); /* TDO = 1 ou 0 */
}
/*****************************************************************************/
/********************************/
/* fonction de reset du */
/* circuit , 5 cycles de */
/* TCK avec TMS=1 */
/********************************/
static void reset_bs() {
int j;
for(j = 0; j < 5; j++) { /* 5 cycle pour effectuer un reset */
/* ordre TDI TMS TRST TCK */
getTDO("0110"); /* TCK = 0 TMS = 1 TDI = 0 */
getTDO("0111"); /* TCK = 1 TMS = 1 TDI = 0 */
}
getTDO("0010");
getTDO("0011");
/* Un coup de TRST */
getTDO("0000");
getTDO("0001");
/* retour a RUN_TEST_IDLE */
getTDO("0010");
getTDO("0011");
}
/*****************************************************************************/
/*******************************************************/
/* Process des pattern du .pat de la ligne de commande */
/*******************************************************/
int send_pat_file(file,resfile,sequence)
char *file,*resfile;
unsigned int sequence;
{
struct timeb start_tck,end_tck,start_io,end_io,start_prg,end_prg;
unsigned long time_tck=0,time_io=0,time_prg=0; /* to compute exec time */
struct paseq *pat = NULL; /* for .pat file */
int process_error=0; /* error ? */
int nbr_pat=0; /*nbr de patterns bs total */
/***INITIALISATION ET COHERENCE***/
ftime(&start_prg);
/* Lecture du fichier de patterns 'paralleles' et on les compte*/
fprintf(stdout,"Loading from %s.pat...",file);
fflush(stdout);
ftime(&start_io);
if ((nbr_pat=compte_pat(file))<0)
{fprintf(stderr," Loading failed!\n");return 1;}
ftime(&end_io);
time_io+=(end_io.time-start_io.time)*1000 + end_io.millitm-start_io.millitm;
/*les fichiers boundary scan sont grands donc partitionner*/
ftime(&start_io);
pat = pat_lodpaseq (file, NULL, sequence);
ftime(&end_io);
time_io+=(end_io.time-start_io.time)*1000 + end_io.millitm-start_io.millitm;
if (pat==NULL || pat->ERRFLG)
{fprintf(stderr,"Loading failed!\n");return 1;}
if (verif_io(pat) == 1) {
fprintf(stderr,
"\nFile %s does not contain boundary-scan IO (tdi, tck, ...)\n",
file);
return(1);}
else fprintf(stdout," %d boundary scan patterns\n",nbr_pat);
open_port(); /* ouverture du port et reset BS */
/* envoie des patterns sur la carte */
ftime(&start_tck);
process_error += send_paseq(pat->CURPAT);
ftime(&end_tck);
time_tck +=
(end_tck.time-start_tck.time)*1000 + end_tck.millitm-start_tck.millitm;
pat_frepacom(pat->CURCOM); /*commentaire debut fichier*/
pat -> CURCOM = pat_addpacom(NULL,ENTETE,0);
/*sauvegarde*/
if (savePatBS_flag) pat_savpaseq(resfile, pat, 20);
/****CONTINUER****/
while (pat!=NULL && pat->ENDFLG!='Y') {
/*affichage pour attendre*/
if (verbose_flag) {
fprintf(stdout,"%.1f%% %d bs patterns, continuing...\n",
(float)((float)(BSpat*100))/nbr_pat,BSpat);}
else {
fprintf(stdout,"\r%.1f%% %d bs patterns, continuing...",
(float)((float)(BSpat*100))/nbr_pat,BSpat);
fflush(stdout);}
ftime(&start_io);
pat = pat_lodpaseq (file, pat, sequence);
ftime(&end_io);
time_io+=
(end_io.time-start_io.time)*1000 + end_io.millitm-start_io.millitm;
if (pat==NULL || pat->ERRFLG)
{fprintf(stderr,"Loading failed!\n");return 1;}
/* envoie des patterns sur la carte */
ftime(&start_tck);
process_error += send_paseq(pat->CURPAT->NEXT);/*du au n+1 patterns deja chargees par pat_lodpaseq*/
ftime(&end_tck);
time_tck +=
(end_tck.time-start_tck.time)*1000+end_tck.millitm-start_tck.millitm;
/*sauvegarde*/
if (savePatBS_flag) pat_savpaseq(resfile, pat, 20);
}
close_port(); /* reset BS et fermeture du port */
if (savePatBS_flag) {
fprintf(stdout,"Saving execution results in %s.pat\n",resfile);}
/****STATISTIQUE****/
/*verification*/
if (process_error)
fprintf(stdout,
"\rExecution of %s on DUT has FAILED (%d error(s))\n",file,
process_error);
else fprintf(stdout,"\rExecution of %s on DUT is successful\n",file);
/*temps*/
ftime(&end_prg);
time_prg=
(end_prg.time-start_prg.time)*1000 + end_prg.millitm-start_prg.millitm;
affiche_time(time_prg);
fprintf(stdout," but only ");fflush(stdout);
affiche_time(time_tck);
fprintf(stdout," for vectors --> ");fflush(stdout);
/*frequence --> seuls les fronts d'horloge*/
if (time_tck!=0) time_tck=(nbr_pat*500)/time_tck;
if (time_tck<1000)
fprintf(stdout,"%ld Hz on TCK\n",time_tck);
else if (time_tck<1000000)
fprintf(stdout,"%ld.%03ld KHz on TCK\n",time_tck/1000,time_tck%1000);
else
fprintf(stdout,"%ld.%03ld MHz on TCK\n",
time_tck/1000000,(time_tck/1000)%1000000);
/*les entrees/sortie*/
fprintf(stdout,"and %.1f%% of time was for i/o file\n",
(float)((float)time_io*100)/time_prg);
erase_paseq(pat);
return (process_error);
}
/*****************************************************************************/
/***********************************/
/* fonction */
/* envoie d'une PASEQ sur le port */
/* // du PC LINUX */
/***********************************/
int send_paseq(ppapat)
struct papat *ppapat;
{
struct paevt *ppaevt, *ptdo;
int flag_evt_tdo, fail_flag = 0;
static char vecteur[5]={'0','0','0','0','\0'}; /*TDI, TMS, TRST, TCK*/
static char vect_tdo[1]={'*'}; /*TDO*/
while(ppapat != NULL) {
flag_evt_tdo = ABSENT ;
for(ppaevt = ppapat -> PAEVT; ppaevt; ppaevt = ppaevt -> NEXT) {
if(ppaevt -> INDEX == table_index[TCK])
vecteur[3] = ppaevt -> USRVAL;/*TCK*/
if(ppaevt -> INDEX == table_index[TRST])
vecteur[2] = ppaevt -> USRVAL; /*TRST*/
if(ppaevt -> INDEX == table_index[TMS])
vecteur[1] = ppaevt -> USRVAL; /*TMS*/
if(ppaevt -> INDEX == table_index[TDI])
vecteur[0] = ppaevt -> USRVAL; /*TDI*/
if(ppaevt -> INDEX == table_index[TDO]) {
flag_evt_tdo = PRESENT;
vect_tdo[0] = ppaevt -> USRVAL;
ptdo = ppaevt ;
}
}/*fin de la boucle sur les evenements*/
if(flag_evt_tdo == ABSENT) {
ppapat -> PAEVT = pat_addpaevt(ppapat -> PAEVT, table_index[TDO], vect_tdo[0]);
ptdo = ppapat -> PAEVT ;
}
if(flag_TRST == ABSENT)
vecteur[2]='1';/*TRST*/
vecteur[4]='\0' ; /*fin du string*/
ptdo -> SIMVAL = getsimval(vecteur); /* envoie du vecteur */
if((ptdo -> USRVAL != '*') && (ptdo -> USRVAL != ptdo -> SIMVAL)) {
if (verbose_flag)
fprintf(stderr,
"Error on pattern %d (Line %d)"
" : expected '%c' actual '%c' on TDO\n",
BSpat,
ppapat->LINE,
ptdo->USRVAL,
ptdo->SIMVAL);
fail_flag ++;
}
ppapat -> SIMFLAG = 'S';
ppapat = ppapat -> NEXT;
BSpat++;
}/*fin boucle sur les patterns*/
return fail_flag ;
}
/*****************************************************************************/
/***********************************/
/* fonction */
/* envoie d'une PAPAT sur le port */
/* // du PC LINUX */
/***********************************/
int send_papat(ppapat)
struct papat *ppapat;
{
struct paevt *ppaevt, *ptdo;
int flag_evt_tdo, fail_flag = 0;
static char vecteur[5]={'0','0','0','0','\0'}; /*TDI, TMS, TRST, TCK*/
static char vect_tdo[1]={'*'};
flag_evt_tdo = ABSENT ;
for(ppaevt = ppapat -> PAEVT; ppaevt; ppaevt = ppaevt -> NEXT) {
if(ppaevt -> INDEX == table_index[TCK])
vecteur[3] = ppaevt -> USRVAL;/*TCK*/
if(ppaevt -> INDEX == table_index[TRST])
vecteur[2] = ppaevt -> USRVAL; /*TRST*/
if(ppaevt -> INDEX == table_index[TMS])
vecteur[1] = ppaevt -> USRVAL; /*TMS*/
if(ppaevt -> INDEX == table_index[TDI])
vecteur[0] = ppaevt -> USRVAL; /*TDI*/
if(ppaevt -> INDEX == table_index[TDO]) {
flag_evt_tdo = PRESENT;
vect_tdo[0] = ppaevt -> USRVAL;
ptdo = ppaevt ;
}
}
if(flag_evt_tdo == ABSENT) {
ppapat -> PAEVT = pat_addpaevt(ppapat -> PAEVT, table_index[TDO], vect_tdo[0]);
ptdo = ppapat -> PAEVT ;
}
if(flag_TRST == ABSENT) vecteur[2]='1';/*TRST*/
ptdo -> SIMVAL = getsimval(vecteur); /* envoie du vecteur */
if((ptdo -> USRVAL != '*') && (ptdo -> USRVAL != ptdo -> SIMVAL)) {
fprintf(stderr, "Error : expected value and real test mismatch on 'tdo'\n");
fail_flag = 1;
}
return fail_flag;
}
/*****************************************************************************/
/****************************************/
/* fonction verification des IO */
/* presence des io du boundary-scan */
/****************************************/
static int verif_io(ppaseq)
struct paseq *ppaseq;
{
int flag_TCK, flag_TDI, flag_TDO, flag_TMS;
int j = 0;
struct paiol *ppaiol;
ppaiol = ppaseq -> PAIOL;
flag_TRST = ABSENT;
flag_TCK = ABSENT;
flag_TDI = ABSENT;
flag_TDO = ABSENT;
flag_TMS = ABSENT;
while(ppaiol) {
if(!strcmp(ppaiol -> NAME, "tck")) {
table_index[TCK] = j;
flag_TCK = PRESENT;
}
else if(!strcmp(ppaiol -> NAME, "trst")) {
table_index[TRST] = j;
flag_TRST = PRESENT;
}
else if(!strcmp(ppaiol -> NAME, "tms")) {
table_index[TMS] = j;
flag_TMS = PRESENT;
}
else if(!strcmp(ppaiol -> NAME, "tdi")) {
table_index[TDI] = j;
flag_TDI = PRESENT;
}
else if(!strcmp(ppaiol -> NAME, "tdo")) {
table_index[TDO] = j;
flag_TDO = PRESENT;
}
else {
if (!isvdd(ppaiol->NAME) && !isvss(ppaiol->NAME) && verbose_flag)
fprintf(stderr,"[WARNING] Ignoring value referring to I/O %s (%s.pat)\n",
ppaiol -> NAME,ppaseq->NAME);
}
ppaiol = ppaiol -> NEXT;
j++;
}
if((flag_TCK && flag_TMS && flag_TDI && flag_TDO) == 0)
return 1 ;
if(flag_TRST == ABSENT) {
fprintf(stderr, "[INFO] There is no TRST Pin \n");
return 2;
}
else
return 0;
}
/*****************************************************************************/
/********************************/
/* fonction de determination */
/* de la longueur du registre */
/* instruction du circuit */
/********************************/
int check_mode()
{
int rinst=0;
int rbs=0;
int rbypass=0;
Infos *inf;
int registre = 0;
int motif = SCAN_MOTIF;
int i, lg_inst, lg_bs, lg_bypass;
int emulbs=1;/*pour l'instant c'est un hardware EMULBS31*/
/*taille de toutes les chaines bs concatenees*/
for (rbs=0,inf=InfosVbe; inf;inf=inf->next) rbs+=inf->lg_bs;
/*taille des registres instructions concatenes*/
for (rinst=0,inf=InfosVbe; inf;inf=inf->next) rinst+=inf->lg_inst;
/*longueur du bypass*/
if (emulbs_flag) rbypass=PCBS_NBR_EMULBS;
else if (InfosVbe!=NULL) rbypass=BYPASS_SIZE;/*la description BSDL suppose de longueur 1; la longueur du registre bypass pour un seul processeur BS*/
if (rbs!=NBR_CELLS*PCBS_NBR_EMULBS) emulbs=0;
if (rinst!=INS_LEN*PCBS_NBR_EMULBS) emulbs=0;
/* -------------- */
/* Check du RI */
/* -------------- */
/* BS : entrees positionnees avant front montant
sortie valides apres front descendant */
open_port(); /* ouverture du port et reset BS */
/* dans l ordre TDI TMS TRST TCK */
getTDO("0010"); /* RUN TEST IDLE */
getTDO("0011");
getTDO("0110");
getTDO("0111"); /* Select DR */
getTDO("0110");
getTDO("0111"); /* Select IR */
getTDO("0010");
getTDO("0011"); /* Capture IR */
getTDO("0010");
getTDO("0011"); /* Shift IR */
/* send motif (shift IR) */
/* shift en attendant de retrouver le motif */
i = 1;
while (registre != SCAN_MOTIF) {
if(motif & 0x80000000) { /* on traite le bit de poids fort de motif */
getTDO("1010");
getTDO("1011");
registre = (registre << 1) | getTDO("1010");
}
else {
getTDO("0010");
getTDO("0011");
registre = (registre << 1) | getTDO("0010");
}
motif = motif << 1; /* bit suivant */
i++;
if(i == MAX_SHIFT)
break; /* si jamais ca deconne! */
}
/* prevention des courts circuits */
reset_bs();
if (i == MAX_SHIFT) {
fprintf(stderr, "Cannot check INSTRUCTION Register (longer than %d bits ???)\n",MAX_SHIFT-32);
fprintf(stderr, "You must check the card connection...\n");
close_port();
return(1);
}
lg_inst = i - 32; /*il faut enlever la taille du motif*/
if (lg_inst!=INS_LEN*PCBS_NBR_EMULBS) emulbs=0;/*recherche du hardware EMULBS31*/
if (rinst == 0) {
fprintf(stdout,"INSTRUCTION Register seems to be %d bits long\n",lg_inst);
}
else if (rinst != lg_inst) {
fprintf(stdout,"Error : INSTRUCTION Register seems to be %d bits long, but file claims it must be %d bits long\n",lg_inst,rinst);
close_port();
return (1);
}
/* -------------- */
/* Check du BYPASS */
/* -------------- */
registre = 0;
motif = SCAN_MOTIF;
/* Chargement de l'instruction BYPASS */
/* depuis le reset */
/* dans l ordre TDI TMS TRST TCK */
getTDO("0010"); /* RUN TEST IDLE */
getTDO("0011");
getTDO("0110");
getTDO("0111"); /* Select DR */
getTDO("0110");
getTDO("0111"); /* Select IR */
getTDO("0010");
getTDO("0011"); /* Capture IR */
getTDO("0010");
getTDO("0011"); /* Shift IR */
for(i = 0; i < lg_inst - 1; i++) {
/* Instruction BYPASS : des 1 partout */
getTDO("1010"); /* Shift IR */
getTDO("1011");
}
/* TMS = 1 */
getTDO("1110"); /* Exit1 IR */
getTDO("1111");
/* TMS = 1 */
getTDO("0110"); /* Update IR */
getTDO("0111");
/* TMS = 0 */
getTDO("0010");
getTDO("0011"); /* RUN TEST IDLE */
/* TMS = 1 */
getTDO("0110");
getTDO("0111"); /* Select DR */
/* TMS = 0 */
getTDO("0010");
getTDO("0011"); /* Capture DR */
/* TMS = 0 */
getTDO("0010");
getTDO("0011"); /* Shift DR */
/* send motif (shift DR) */
/* shift en attendant de retrouver le motif */
i = 1;
while (registre != SCAN_MOTIF) {
if(motif & 0x80000000) { /* on traite le bit de poids fort de motif */
getTDO("1010");
getTDO("1011");
registre = (registre << 1) | getTDO("1010");
}
else {
getTDO("0010");
getTDO("0011");
registre = (registre << 1) | getTDO("0010");
}
motif = motif << 1; /* bit suivant */
i++;
if(i == MAX_SHIFT)
break; /* si jamais ca deconne! */
}
/* prevention des courts circuits */
reset_bs();
if (i == MAX_SHIFT) {
fprintf(stderr, "Cannot check BYPASS register (longer than %d bits ???)\n",MAX_SHIFT-32);
fprintf(stderr, "You must check the card connection...\n");
close_port();
return(1);
}
lg_bypass = i - 32;/*32=longueur du motif*/
if (lg_bypass!=PCBS_NBR_EMULBS) emulbs=0;/*recherche du hardware EMULBS31*/
if (rbypass == 0) {
fprintf(stdout,"BYPASS register seems to be %d bits long\n",lg_bypass);
if (lg_bypass > 1)
fprintf(stdout,"--> There seem to be %d Boundary-scan chips on this device\n",lg_bypass);
}
else if (!emulbs && rbypass != lg_bypass) {
fprintf(stdout,"Error : BYPASS register seems to be %d bits long, but file claims it must be %d bits long\n",lg_bypass,rbypass);
close_port();
return (1);
}
/* ---------------------- */
/* Check du BOUNDARY-SCAN */
/* ---------------------- */
registre = 0;
motif = SCAN_MOTIF;
/* dans l ordre TDI TMS TRST TCK */
getTDO("0010"); /* RUN TEST IDLE */
getTDO("0011");
getTDO("0110");
getTDO("0111"); /* Select DR */
getTDO("0110");
getTDO("0111"); /* Select IR */
getTDO("0010");
getTDO("0011"); /* Capture IR */
getTDO("0010");
getTDO("0011"); /* Shift IR */
for(i = 0; i < lg_inst - 1; i++) {
/* Instruction EXTEST : que des 0 ------>pour EMULBS31 c'est le code BYPASS*/
getTDO("0010"); /* Shift IR */
getTDO("0011");
}
/* TMS = 1 */
getTDO("0110"); /* Exit1 IR */
getTDO("0111");
/* TMS = 1 */
getTDO("0110"); /* Update IR */
getTDO("0111");
/* TMS = 0 */
getTDO("0010");
getTDO("0011"); /* RUN TEST IDLE */
/* TMS = 1 */
getTDO("0110");
getTDO("0111"); /* Select DR */
/* TMS = 0 */
getTDO("0010");
getTDO("0011"); /* Capture DR */
/* TMS = 0 */
getTDO("0010");
getTDO("0011"); /* Shift DR */
/* send motif (shift DR) */
/* shift en attendant de retrouver le motif */
i = 1;
while (registre != SCAN_MOTIF) {
if(motif & 0x80000000) { /* on traite le bit de poids fort de motif */
getTDO("1010");
getTDO("1011");
registre = (registre << 1) | getTDO("1010");
}
else {
getTDO("0010");
getTDO("0011");
registre = (registre << 1) | getTDO("0010");
}
motif = motif << 1; /* bit suivant */
i++;
if(i == MAX_SHIFT)
break; /* si jamais ca deconne! */
}
/* prevention des courts circuits */
reset_bs();
if (i == MAX_SHIFT) {
fprintf(stderr, "Cannot check BOUNDARY-SCAN register (longer than %d bits ???)\n",MAX_SHIFT-32);
fprintf(stderr, "You must check the card connection...\n");
close_port();
return(1);
}
lg_bs = i - 32;
if (lg_bs!=PCBS_NBR_EMULBS) emulbs=0; /*comme pour le bypass!!!*/
if (rbs == 0) {
fprintf(stdout,"BOUNDARY-SCAN register seems to be %d bits long\n",lg_bs);
}
else if (!emulbs && rbs != lg_bs) { /*emulbs est un cas special*/
fprintf(stdout,"Error : BOUNDARY-SCAN register seems to be %d bits long, but file claims it must be %d bits long\n",lg_bs,rbs);
close_port();
return (1);
}
if (emulbs_flag && !emulbs) { /*emulbs est un cas special*/
fprintf(stdout,"Error : BOUNDARY-SCAN register seems to be other than the EMULBS card interface\n");
close_port();
return (1);
}
if (verbose_flag || check_flag) {
if (emulbs) fprintf(stdout,"the %d EMULBS31 have been recognized\n",
PCBS_NBR_EMULBS);
else fprintf(stdout,"boundary scan chip recognized : RI=%d, BS=%d\n",
lg_inst,lg_bs);
}
close_port();
return(0);
}
/*****************************************************************************/
/******************************* END OF FILE *********************************/
/*****************************************************************************/

View File

@ -0,0 +1,100 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Philippe OLEK, Olivier SIROL ##*/
/*## (Projet Maitrise EEA) ##*/
/*## Initial Revision : April 1995 ##*/
/*## Revision : 20 may 1995 ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
#ifndef _BSTESTHEADER_
#define _BSTESTHEADER_
/* index des signaux boundary-scan */
/* TCK relie a DATA0 */
/* TRST relie a DATA1 */
/* TMS relie a DATA2 */
/* TDI relie a DATA3 */
/* TDO relie a STATUS10 (SELECT) */
/* */
/* ordre TCK TDI TDO TMS TRST */
/* pattern : "01?010" */
#define TDI 0
#define TMS 3
#define TRST 4
#define TCK 2
#define TDO 1
/* .pat */
#define LABELSIZE 20
#define ABSENT 0
#define PRESENT 1
/* motif que l'on envoi au TAP (mode check) */
#define SCAN_MOTIF 0xE04C4F48 /* "BS" (32 bits) */
#define MAX_SHIFT 5000 /* nb de shift max avant de laisser tomber */
/* code d'erreur renvoye lors d'un LPSCAN ERROR */
#define LPSCAN_ERROR 10
/* STATUS REGISTER de la carte parallele */
#define SELECT 0x10 /* STATUS bit 4 */
/* commandes IOCTL du driver LPSCAN */
#define CHECK_CARD_PRESENT 0x0001 /* pour la verification de */
/* presence de la carte paralelle */
#define CHECK_BSCARD_PRESENT 0x0002 /* pour la verification de */
/* presence de la carte boundary */
/* scan et de son alim */
/*****************************************************************************/
/*ouvre le port parallele*/
void open_port();
/*ferme le port parallele*/
void close_port();
/*envoie sur le hardware de patterns au format boundary scan source en n sequences, les parametres sont des noms de fichier*/
int send_pat_file(char *source,char *destination,unsigned int nbr_seq);
/*envoi d'une sequence de patterns sur le port paralelle et retourne le nombre de patterns erronnees*/
int send_paseq(struct papat *ppapat);
/*envoi d'une pattern sur le port paralelle et renvoie 0 si erreur sur valeur, 0 sinon*/
int send_papat(struct papat *ppapat);
/*envoi le parametre s dans l'ordre TDI TMS TRST TCK sur le DUT et renvoie la valeur de TDO*/
char getsimval(char *s);
/*verifie que le hardware a des caracteristiques boundary scan et/ou emul31bs et renvoie 0 si carte bs bien connectee et 0 sinon*/
int check_mode();
/*retourne le nom du driver de la carte externe*/
char *current_lpscan_device();
#endif
/*****************************************************************************/
/******************************* END OF FILE *********************************/
/*****************************************************************************/

View File

@ -0,0 +1,36 @@
/***************************** taille PGA ************************************/
#define NBR_LIGNES_PGA PCBS_PGA_SIZE /*hauteur du PGA*/
#define NBR_COLONNES_PGA PCBS_PGA_SIZE /*largeur du PGA*/
#define NBR_DEB_PGA 1 /*premier chiffre du PGA*/
#define NBR_FIN_PGA NBR_COLONNES_PGA /*dernier chiffre du PGA*/
#define LETTRE_DEB_PGA 'a' /*premiere lettre du PGA*/
#define LETTRE_FIN_PGA 'a'+NBR_LIGNES_PGA+1 /*derniere lettre du PGA*/
/*********** Donnees relatives a l'ensemble Boundary Scan ********************/
#define INS_LEN 2 /*taille du registre instruction de la carte EMULBS 31*/
#define NBR_CELLS 31 /*nombre de cellules BS dans EMUL31 Rq: de 0 a 30*/
#define BYPASS_SIZE 1 /*revient a indiquer le nbr de cycles de retard*/
#define _BYPASS0 "00" /*instructions d'EMUL31*/
#define _BYPASS1 "11"
#define _INTEST "10"
#define _CONFIG "01"
/*****************************************************************************/
#define EMUL_FILE_NAME "emul_connexions" /*pour la verification du parseur*/
#define PGA_FILE_NAME "pga_connexions" /*pour la verification du parseur*/
/*****************************************************************************/
/*****************************************************************************/
/***************************** END OF FILE ***********************************/
/*****************************************************************************/

View File

@ -0,0 +1,311 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Francois DONNET (1998) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
/***************** parseur etablissant les connections ***********************/
/*************** entre le PGA et les interfaces EMULBS 31 ********************/
/* */
/* parametres : FILE *yyin */
/* Infos *InfosVbe */
/* resultats: ht *HSH_DATA,*HSH_VDD,*HSH_VSS */
/* erreur : int FLAG_ERR */
/* */
/*****************************************************************************/
/*
--exemple for emul_connexions
--left-hand is for EMULBS connector
--right-hand is for PGA connector
pcbs emul_connexions V2.0;
0 <=a:1;
185 <=r:16;
56 <=d:5;
76 <=d:4;
80 <=g:2;
Vdd <=e:6;
d_Vss<=a:2;
*/
%{
#include "global.h"
extern int yylex(); /*fct du lexeur emul.lex*/
extern Infos *InfosVbe; /*resultat final du parseur*/
extern int FLAG_ERR; /*si une erreur est arrivee*/
extern int NBR_LIGNES; /*pour message d'erreur*/
extern Cellules *EMUL[PCBS_NBR_EMULBS*NBR_CELLS]; /*lien entre n° et EMUL*/
extern ht *HSH_DATA; /*lien entre PGA et EMUL*/
extern ht *HSH_VSS; /*lien entre PGA et Vss*/
extern ht *HSH_VDD; /*lien entre PGA et Vdd*/
static ht *HSH_PGA_USED; /*connecteurs PGA deja affectes*/
static ht *HSH_EMUL_USED; /*broches emul deja utilisees*/
void emul_flag(int x);
%}
%union {
int val;
float flottant;
char *mot;
char lettre;
}
%token _PCBS
%token Version
%token Num_version
%token _IN
%token _OUT
%token _INOUT
%token Pt_virg
%token Db_pt
%token Assign
%token Index
%token Nbr
%token Mot
%token Lettre
%token Par_ouv Par_fer
%token Cro_ouv Cro_fer
%type <mot> Index
%type <mot> Mot
%type <lettre> Lettre
%type <val> Nbr
%type <mot> index .index.
%type <flottant> Num_version
%start fichier
%%
fichier
:
{
/*initialisation*/
NBR_LIGNES=1;
FLAG_ERR=0;
}
header
{
HSH_PGA_USED=addht(NBR_LIGNES_PGA*NBR_COLONNES_PGA);
HSH_EMUL_USED=addht(PCBS_NBR_EMULBS*NBR_CELLS);
}
..declarations..
{
/*liberation memoire*/
delht(HSH_PGA_USED);
delht(HSH_EMUL_USED);
}
;
declaration
:alimentation
|donnee
|error /*gestion des erreurs*/
{/*synchronisation avec point virgule ou fin de fichier*/
while (yychar!=Pt_virg && yychar!=0) yychar=yylex();
yychar=yylex();
yyerrok;}
;
alimentation
:Mot
.index.
Assign
Lettre
Db_pt
Nbr
Pt_virg
{
char *pga=(char*)concat(ctoa($4),itoa($6));
/****** test du PGA *******/
/*ligne PGA incorrecte*/
if ($4<LETTRE_DEB_PGA || $4>LETTRE_FIN_PGA || $4=='i' || $4=='o') {fprintf(stderr,"%d: letter '%c' for a line is forbidden!\n",NBR_LIGNES,$4);emul_flag(-2);break;}
/*colonne PGA incorrecte*/
if ($6<NBR_DEB_PGA || $6>NBR_FIN_PGA) {fprintf(stderr,"%d: number '%d' for a column is forbidden!\n",NBR_LIGNES,$6);emul_flag(-2);break;}
/* connecteur PGA deja utilise */
if (gethtitem(HSH_PGA_USED,pga)!=EMPTYHT) {fprintf(stderr,"%d: connector PGA %c %d already used!\n",NBR_LIGNES,$4,$6);emul_flag(-2);break;}
else addhtitem(HSH_PGA_USED,pga, 1);
/****** alimentation ******/
if (isvss($1)) addhtitem(HSH_VSS, pga, 1); /*attention EMPTYHT=-1!!!!*/
else if (isvdd($1)) addhtitem(HSH_VDD, pga, 1); /*attention EMPTYHT=-1!!!!*/
else {fprintf(stderr,"%d: left-hand connector %s must be Vdd/Vss or n° between 0 and %d!\n",NBR_LIGNES,$1,PCBS_NBR_EMULBS*NBR_CELLS-1);emul_flag(-2);break;}
}
;
donnee
:Nbr
Assign
Lettre
Db_pt
Nbr
Pt_virg
{
char *pga=(char*)concat(ctoa($3),itoa($5));
/****** les EMULBS *******/
/* il y a un nombre maximum de connecteurs EMUL */
if ($1>=PCBS_NBR_EMULBS*NBR_CELLS || $1<0) {fprintf(stderr,"%d: EMULBS31 n°%d doesn't exist! Index must be between 0 and %d\n",NBR_LIGNES,$1,PCBS_NBR_EMULBS*NBR_CELLS-1);emul_flag(-1);break;}
/* connecteur EMUL deja utilise */
if (gethtitem(HSH_EMUL_USED,EMUL[$1])!=EMPTYHT) {fprintf(stderr,"%d: connector n°%d already used!\n",NBR_LIGNES,$1);emul_flag(-2);break;}
else addhtitem(HSH_EMUL_USED,EMUL[$1], 1);
/****** test du PGA *******/
/*ligne PGA incorrecte*/
if ($3<LETTRE_DEB_PGA || $3>LETTRE_FIN_PGA || $3=='i' || $3=='o') {fprintf(stderr,"%d: letter '%c' for a line is forbidden!\n",NBR_LIGNES,$3);emul_flag(-2);break;}
/*colonne PGA incorrecte*/
if ($5<NBR_DEB_PGA || $5>NBR_FIN_PGA) {fprintf(stderr,"%d: number '%d' for a column is forbidden!\n",NBR_LIGNES,$5);emul_flag(-2);break;}
/* connecteur PGA deja utilise */
if (gethtitem(HSH_PGA_USED,pga)!=EMPTYHT) {fprintf(stderr,"%d: connector PGA %c %d already used!\n",NBR_LIGNES,$3,$5);emul_flag(-2);break;}
else addhtitem(HSH_PGA_USED,pga, 1);
/******* chargement des donnees ******/
addhtitem(HSH_DATA, pga, (int)EMUL[$1]);
}
;
header
:_PCBS
Mot
Version
Num_version
Pt_virg
{
char c;
if (strcmp($2,EMUL_FILE_NAME)) {
fprintf(stderr,"%s doesn't recognise it\nDo you want to continue? (y/n) ",PROGRAM_NAME);
fflush(stderr); /*affichage immediat*/
fseek(stdin,0,SEEK_END); /*enlever les anciens caracteres*/
c=getc(stdin);
getc(stdin);
if (c!='y' && c!='Y') {emul_flag(-3);return -1;}
emul_flag(3);
}
if (FLAG_ERR==0 && $4>atof(PCBS_VERSION)) {
fprintf(stderr,"You use an old version of %s\nDo you want to continue? (y/n) ",PROGRAM_NAME);
fflush(stderr); /*affichage immediat*/
fseek(stdin,0,SEEK_END); /*enlever les anciens caracteres*/
c=getc(stdin);
getc(stdin);
if (c!='y' && c!='Y') {emul_flag(-4);return -1;}
emul_flag(4);
}
if (FLAG_ERR==0) fprintf(stdout,"\n"); /*coherence dans l'affichage*/
}
|error /*gestion des erreurs*/
{/*synchronisation avec point virgule ou fin de fichier*/
char c;
while (yychar!=Pt_virg && yychar!=0) yychar=yylex();
yychar=yylex();
yyerrok;
/*demande d'arret*/
fprintf(stderr,"%s doesn't recognise this file\nDo you want to continue? (y/n) ",PROGRAM_NAME);
fflush(stderr); /*affichage immediat*/
fseek(stdin,0,SEEK_END); /*enlever les anciens caracteres*/
c=getc(stdin);
getc(stdin);
if (c!='y' && c!='Y') {emul_flag(-3);return -1;}
FLAG_ERR=3;
}
;
..declarations..
:/*empty*/
|declaration ..declarations..
;
.index.
:index {$$=$1;}
|/*empty*/ {$$=NULL;}
;
index:
Par_ouv
Index
Par_fer
{$$=$2;}
|Cro_ouv
Index
Cro_fer
{$$=$2;}
;
%%
/**************************** change le FLAG_ERR *****************************/
void emul_flag(int x)
{
/*sauvegarde de la premiere erreur ou du dernier warning*/
if (FLAG_ERR>=0) FLAG_ERR=x;
}
/****************** traitement des erreurs de syntaxe ************************/
int yyerror()
{
fprintf(stderr,"%d: syntax error",NBR_LIGNES);
switch ((int)yychar) {
case Mot: fprintf(stderr," append at '%s'\n",yylval.mot);break;
case Lettre: fprintf(stderr," append at '%s'\n",yylval.mot);break;
case Index: fprintf(stderr," append at '%s'\n",yylval.mot);break;
case Nbr: fprintf(stderr," append at '%d'\n",yylval.val);break;
case Pt_virg: fprintf(stderr," append at ';'\n");break;
case Assign: fprintf(stderr," append at '<='\n");break;
case Db_pt: fprintf(stderr," append at ':'\n");break;
case Cro_ouv: fprintf(stderr," append at '['\n");break;
case Cro_fer: fprintf(stderr," append at ']'\n");break;
case Par_ouv: fprintf(stderr," append at '('\n");break;
case Par_fer: fprintf(stderr," append at ')'\n");break;
case _IN: fprintf(stderr," append at 'in'\n");break;
case _OUT: fprintf(stderr," append at 'out'\n");break;
case _INOUT: fprintf(stderr," append at 'inout'\n");break;
case _PCBS: fprintf(stderr," append at 'pcbs'\n");break;
case Version: fprintf(stderr," append at 'Version'\n");break;
case Num_version:fprintf(stderr," append at '%.1f'\n",yylval.flottant);break;
case 0: fprintf(stderr," ';' is missing\n");break;/*EOF*/
default: fprintf(stderr," for '%c' not allowed!\n",yychar);
}
emul_flag(-1);
return 1;
}
/*****************************************************************************/
/**************************** END of LEX&YACC ********************************/
/*****************************************************************************/

View File

@ -0,0 +1,58 @@
/****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <malloc.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/timeb.h>
#include <sys/fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <signal.h>
#include <fcntl.h>
#include <mut.h>
#include <log.h>
#include <mlo.h>
#include <beh.h>
#include <bvl.h>
#include <pat.h>
#include <phl.h>
#include <ppt.h>
/************************* version de PcBs ***********************************/
#define TRUE 1
#define FALSE 0
#define ENTETE PROGRAM_NAME " version " PCBS_VERSION " for boundary scan"
/************************ presentation des patterns **************************/
#define LABEL_BS_SIZE 30 /*taille des labels des patterns BS sauvegardées*/
#define LABEL_FCL_SIZE 15 /*taille des labels des patterns fonctionnelles*/
#define BS_ESPACE 2 /*espaces entre les veteurs BS*/
/*****************************************************************************/
/************************** variables globales *******************************/
extern struct Infos *InfosVbe; /* Pour les informations */
/* flags and vars for command line processing */
extern int verbose_flag; /*affichage de tous les commmentaires */
extern int execute_flag; /*mode avec hardware */
extern int savePatSRC_flag; /*sauvegardr pattern // */
extern int savePatBS_flag; /*sauvegarder pattern BS */
extern int check_flag; /*est-ce le mode check */
extern int emulbs_flag; /*est-ce pour l'interface EMULBS31? */
/*****************************************************************************/
/* Les variables de chaque fichier .c */
#include "emul31.h"
#include "pcbs.h"
#include "type_infos.h"
#include "infos.h"
#include "verif.h"
#include "traduction.h"
#include "util.h"
#include "bstools.h"
#include "parseur.h"
#include "sig.h"
/*****************************************************************************/
/******************************* END OF FILE *********************************/
/*****************************************************************************/

View File

@ -0,0 +1,922 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Philippe OLEK, Olivier SIROL (1995) ##*/
/*## Authors : Eric MECHIN (1996) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
/****************************************************************************/
#include "global.h"
/* Pointeurs dans la structure de donnees informations */
static Codes *InstCodeCourant=NULL;
static Instructions *InstCourante=NULL;
static Cellules *CelCourante=NULL;
/****************************************************************************/
/* Avale les espaces et es retours chariot */
static int Separateurs(chaine, index)
char *chaine;
int index;
{
while(chaine[index] == ' ' || chaine[index] == '\n')
index++;
return index;
}
/****************************************************************************/
/* Analyse la chaine de caracteres formant le nom de l'instructions */
static int NomInst(ligne, indexe)
char *ligne;
int indexe;
{
char *chaine;
int j = 0, longueur = strlen(ligne);
chaine = (char*)mbkalloc(longueur + 1);
while(ligne[indexe] != ' ' && ligne[indexe] != '\n' && ligne[indexe] != '(') {
chaine[j++] = ligne[indexe++];
if(indexe == longueur) {
fprintf(stderr,"position %d: incomplete instruction line!\n", indexe);
mbkfree(chaine);
return(0);
}
}
if(j == 0) {
fprintf(stderr,"position %d: instruction name is missing!\n", indexe);
mbkfree(chaine);
return(0);
}
chaine[j] = '\0';
InstCourante -> nom = (char*)namealloc(chaine);
mbkfree(chaine);
return indexe++;
}
/****************************************************************************/
/* Analyse la chaine de caracteres formant un code de l'instructions */
static int CodesInst(ligne, indexe)
char *ligne;
int indexe;
{
static int NbBit = 0; /*nbr de bits de l'instruction precedente, pour verifier que les instructions ont toutes la meme longueur*/
int j = 0, longueur = strlen(ligne);
char *valeur;
valeur = (char*)mbkalloc(256);
while(TRUE) {
while(ligne[indexe] == '0' || ligne[indexe] == '1') {
valeur[j++] = ligne[indexe++];
if(indexe >= longueur) {
fprintf(stderr,"code instruction line incomplete!\n");
mbkfree(valeur);
return(0);
}
}
valeur[j] = '\0';
if(valeur[0] == '\0') {
fprintf(stderr,"position %d: binary value for coding instruction is missing\n", indexe);
mbkfree(valeur);
return(0);
}
if(InstCodeCourant -> valeur == NULL)
InstCodeCourant -> valeur = (char*)namealloc(valeur);
else {
InstCodeCourant -> suivant = (Codes*)mbkalloc(sizeof(Codes));
InstCodeCourant = InstCodeCourant -> suivant;
InstCodeCourant -> valeur = (char*) namealloc(valeur);
InstCodeCourant -> suivant = NULL;
}
valeur[0] = '\0';
if(NbBit == 0)
NbBit = j;
else if(NbBit != j) {
fprintf(stderr,"instruction codes have different sizes!\n");
mbkfree(valeur);
return(0);
}
j = 0;
indexe = Separateurs(ligne, indexe);
if(indexe == longueur) {
fprintf(stderr,"incomplete line!\n");
mbkfree(valeur);
return(0);
}
if(ligne[indexe] != ')') {
if(ligne[indexe] == ',') {
indexe++;
if(indexe == longueur) {
fprintf(stderr,"instructions code line Erreur incomplete!\n");
mbkfree(valeur);
return(0);
}
indexe = Separateurs(ligne, indexe);
if(indexe == longueur) {
fprintf(stderr,"instructions code line Erreur incomplete!\n");
mbkfree(valeur);
return(0);
}
}
else {
fprintf(stderr,"position %d: a comma is missing in instruction code!\n", indexe);
mbkfree(valeur);
return(0);
}
}
else {mbkfree(valeur);return indexe;}
}
}
/****************************************************************************/
/* Analyse la chaine de caracteres formant les codes de l'instructions */
static int CodeOpInst(ligne)
char *ligne;
{
int i = 0, longueur = strlen(ligne);
if(ligne[i++] != '"') {
fprintf(stderr,"position %d: '\"' is missing in instruction encoding!\n", i);
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: line incomplete in instruction encoding!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: line incomplete in instruction encoding!\n", i);
return(0);
}
while(i < longueur - 3) {
if(InstCourante -> code -> valeur != NULL) {
InstCourante -> suivant = (Instructions*)mbkalloc(sizeof(Instructions));
InstCourante -> suivant -> nom = NULL;
InstCourante -> suivant -> code = NULL;
InstCourante -> suivant -> suivant = NULL;
InstCourante -> suivant -> code = (Codes*)mbkalloc(sizeof(Codes));
InstCourante -> suivant -> code -> valeur = NULL;
InstCourante -> suivant -> code -> suivant = NULL;
InstCourante = InstCourante -> suivant;
InstCodeCourant = InstCourante -> code;
}
if(!(i = NomInst(ligne, i))) {
fprintf(stderr,"instruction code error!\n");
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: incomplete lione in code!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: incomplete line in encoding instructions!\n", i);
return(0);
}
if(ligne[i++] != '(') {
fprintf(stderr,"position %d: '(' is missing in encoding instructions!\n", i);
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: incomplete line in encoding instructions!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: incomplete line in encoding instructions!\n", i);
return(0);
}
if(!(i = CodesInst(ligne, i))) {
fprintf(stderr,"Error in encoding instructin codes!\n");
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: incomplete line in encoding instructions!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: incomplete line in encoding instructions!\n", i);
return(0);
}
if(ligne[i++] != ')') {
fprintf(stderr,"position %d: ')' is missing in encoding instructions!\n", i);
return(0);
}
if(i < longueur - 3) {
i = Separateurs(ligne, i);
if(ligne[i++] != ',') {
fprintf(stderr,"position %d: a comma is missing in encoding instructions!\n", i);
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: incomplete line in encoding instructions!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: incomplete line in encoding instructions!\n", i);
return(0);
}
}
}
if(ligne[i++] != ';') {
fprintf(stderr,"position %d: ';' is missing in encoding instructions!\n", i);
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: incomplete line in encoding instructions!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: incomplete line in encoding instructions!\n", i);
return(0);
}
if(ligne[i] != '"') {
fprintf(stderr,"position %d: '\"' is missing in encoding instructions!\n", i);
return(0);
}
return(1);
}
/****************************************************************************/
/* Initialisation de la structure de donnees associee au fichier
informations */
static int InitStruct() {
int i = 0;
InfosVbe=(Infos*) mbkalloc(sizeof(Infos));
InfosVbe->lg_inst = 0;
InfosVbe->inst = NULL;
InfosVbe->lg_bs = 0;
InfosVbe->cel = NULL;
InfosVbe->next=NULL; /*le .bsdl ne peut decrire qu'un seul circuit BS*/
InfosVbe->inst = (Instructions*)mbkalloc(sizeof(Instructions));
if (InfosVbe->inst == NULL) {
fprintf(stderr,"Out of memory!\n");
exit(1);
}
InfosVbe->inst -> nom = NULL;
InfosVbe->inst -> code = NULL;
InfosVbe->inst -> suivant = NULL;
InfosVbe->inst -> code = (Codes*)mbkalloc(sizeof(Codes));
if (InfosVbe->inst -> code == NULL) {
fprintf(stderr,"Out of memory!\n");
exit(1);
}
InfosVbe->inst -> code -> valeur = NULL;
InfosVbe->inst -> code -> suivant = NULL;
InfosVbe->cel = (Cellules*)mbkalloc(sizeof(Cellules));
if (InfosVbe->cel == NULL) {
fprintf(stderr,"Out of memory!\n");
exit(1);
}
InfosVbe->cel -> nom = NULL;
for(i = 0; i < 5; i++)
InfosVbe->cel -> donnees[i] = -1;
InfosVbe->cel -> suivant = NULL;
InstCodeCourant = (Codes*)(InfosVbe->inst -> code);
InstCourante = (Instructions*)InfosVbe->inst;
CelCourante = (Cellules*)InfosVbe->cel;
return(1);
}
/****************************************************************************/
/* Analyse la chaine de caracteres formant le nom de la cellule Boundary
Scan */
static int Nom(ligne, indexe)
char *ligne;
int indexe;
{
char *chaine;
int j = 0, longueur = strlen(ligne);
chaine = (char *)mbkalloc(longueur + 1);
/*controle des separateurs*/
while(ligne[indexe] != ' ' && ligne[indexe] != '\n' &&
ligne[indexe] != ',' && ligne[indexe] != '(') {
chaine[j++] = ligne[indexe++];
if(indexe == longueur) {
fprintf(stderr,"position %d: incomplete line in name!\n", indexe);
mbkfree(chaine);
return(0);
}
}
/*elimination des separateurs*/
if(ligne[indexe] == ' ' || ligne[indexe] == '\n') {
indexe = Separateurs(ligne, indexe);
if(indexe == longueur) {
fprintf(stderr,"position %d: incomplete line in name!\n", indexe);
mbkfree(chaine);
return(0);
}
}
if(ligne[indexe] == '(') {
indexe++;
indexe = Separateurs(ligne, indexe);
if(indexe == longueur) {
fprintf(stderr,"position %d: incomplete line in name!\n", indexe);
mbkfree(chaine);
return(0);
}
if(ligne[indexe] == ')') {
fprintf(stderr,"position %d: a value is missing in name!\n", indexe);
mbkfree(chaine);
return(0);
}
if(ligne[indexe] == ',') {
fprintf(stderr,"position %d: a value and ')' are missing in name!\n", indexe);
mbkfree(chaine);
return(0);
}
chaine[j++] = ' ';
while(ligne[indexe] != ')') {
chaine[j++] = ligne[indexe++];
if(indexe == longueur) {
fprintf(stderr,"position %d: incomplete line in name!\n", indexe);
mbkfree(chaine);
return(0);
}
}
indexe++;
indexe = Separateurs(ligne, indexe);
if(indexe == longueur) {
fprintf(stderr,"position %d: incomplete line in name!\n", indexe);
mbkfree(chaine);
return(0);
}
}
chaine[j] = '\0';
CelCourante -> nom = namealloc(chaine);
mbkfree(chaine);
return indexe++;
}
/****************************************************************************/
/* Analyse la chaine de caracteres formant le mode la cellule Boundary Scan */
static int Mode(ligne, indexe)
char *ligne;
int indexe;
{
char *chaine;
int j = 0, longueur = strlen(ligne);
chaine = (char*)mbkalloc(longueur + 1);
while(ligne[indexe] != ' ' && ligne[indexe] != '\n' && ligne[indexe] != ',') {
chaine[j++] = toupper(ligne[indexe++]);
if(indexe == longueur) {
fprintf(stderr,"position %d: incomplete line in mode!\n", indexe);
mbkfree(chaine);
return(0);
}
}
chaine[j] = '\0';
if (!strcmp(chaine, "INPUT"))
CelCourante -> donnees[DMODE] = INPUT;
else if(!strcmp(chaine, "OUTPUT3"))
CelCourante -> donnees[DMODE] = OUTPUT3;
else if(!strcmp(chaine, "OUTPUT2"))
CelCourante -> donnees[DMODE] = OUTPUT2;
else if(!strcmp(chaine, "CONTROL"))
CelCourante -> donnees[DMODE] = CONTROL;
else if(!strcmp(chaine, "CLOCK"))
CelCourante -> donnees[DMODE] = CLOCK;
else {
fprintf(stderr,"position %d: mode unknown!\n", indexe);
mbkfree(chaine);
return(0);
}
mbkfree(chaine);
return indexe++;
}
/****************************************************************************/
/* Analyse la chaine de caracteres formant le libelle de la cellule qui
controle la presente cellule Boundary Scan 3 etats */
static int Control(ligne, indexe)
char *ligne;
int indexe;
{
int longueur = strlen(ligne);
if(indexe == longueur) {
fprintf(stderr,"position %d: incomplete line in binary!\n", indexe);
return(0);
}
if(ligne[indexe] == '*') {
CelCourante -> donnees[DCONTROLE] = -1;
indexe++;
}
else if(ligne[indexe] >= '0' && ligne[indexe] <= '9') {
CelCourante -> donnees[DCONTROLE] = 0;
while(ligne[indexe] >= '0' && ligne[indexe] <= '9')
CelCourante -> donnees[DCONTROLE] = CelCourante -> donnees[DCONTROLE] * 10
+ ligne[indexe++] - '0';
}
else {
fprintf(stderr,"position %d: value unknown for control!\n", indexe);
return(0);
}
return indexe;
}
/****************************************************************************/
/* Analyse la chaine de caracteres formant soit la valeur de defaut soit la
valeur de commande de la cellule Boundary Scan */
static int Binaire(ligne, indexe, pos)
char *ligne;
int indexe;
int pos;
{
int longueur = strlen(ligne);
if(indexe == longueur) {
fprintf(stderr,"position %d: incomplete line in binary!\n", indexe);
return(0);
}
if(ligne[indexe] == '0')
CelCourante -> donnees[pos] = 0;
else if(ligne[indexe] == '1')
CelCourante -> donnees[pos] = 1;
else if(ligne[indexe] == '*')
CelCourante -> donnees[pos] = -1;
else {
fprintf(stderr,"position %d: binary value unknown!\n", indexe);
return(0);
}
indexe++;
return indexe;
}
/****************************************************************************/
/* Analyse la chaine de caracteres formant l'information d'inversion ou non
de la cellule Boundary Scan */
static int Inversion(ligne, indexe)
char *ligne;
int indexe;
{
int longueur = strlen(ligne);
if(indexe == longueur) {
fprintf(stderr,"position %d: incomplete line in inversion!\n", indexe);
return(0);
}
if(toupper(ligne[indexe]) == 'O')
CelCourante -> donnees[DINVERSION] = 1;
else if(toupper(ligne[indexe]) == 'N')
CelCourante -> donnees[DINVERSION] = 0;
else if(ligne[indexe] == '*')
CelCourante -> donnees[DINVERSION] = -1;
else {
fprintf(stderr,"position %d: character unknown in inversion!\n", indexe);
return(0);
}
indexe++;
return indexe;
}
/****************************************************************************/
/* Analyse la ligne donnant les informations sur la cellule Boundary Scan */
static int CelluleBS(ligne)
char *ligne;
{
int i = 0, longueur = strlen(ligne);
while(i < longueur) {
if(ligne[i++] != '"') {
fprintf(stderr,"position %d: '\"' is missing in BS cell!\n", i);
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
/*nom du connecteur*/
if(!(i = Nom(ligne, i))) {
fprintf(stderr,"Error BS cell!\n");
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
if(ligne[i++] != ',') {
fprintf(stderr,"position %d: a comma is missing in BS cell!\n", i);
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
/*mode de la cellule*/
if(!(i = Mode(ligne, i))) {
fprintf(stderr,"Error BS cell!\n");
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
if(ligne[i++] != ',') {
fprintf(stderr,"position %d: a comma is missing in BS cell!\n", i);
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
/*defaut*/
if(!(i = Binaire(ligne, i, DDEFAUT))) {
fprintf(stderr,"Error BS cell!\n");
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
if(ligne[i++] != ',') {
fprintf(stderr,"position %d: a comma is missing in BS cell!\n", i);
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
/*control*/
if(!(i = Control(ligne, i))) {
fprintf(stderr,"Error BS cell!\n");
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
if(ligne[i++] != ',') {
fprintf(stderr,"position %d: a comma is missing in BS cell!\n", i);
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
/*commande*/
if(!(i = Binaire(ligne, i, DCOMMANDE))) {
fprintf(stderr,"Error BS cell!\n");
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
if(ligne[i++] != ',') {
fprintf(stderr,"position %d: a comma is missing in BS cell!\n", i);
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
/*inversion*/
if(!(i = Inversion(ligne, i))) {
fprintf(stderr,"Error BS cell!\n");
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
if(ligne[i++] != ';') {
fprintf(stderr,"position %d: ';' is missing in BS cell!\n",i);
return(0);
}
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
i = Separateurs(ligne, i);
if(i == longueur) {
fprintf(stderr,"position %d: BS cell line incomplete!\n", i);
return(0);
}
if(ligne[i++] != '"') {
fprintf(stderr,"position %d: '\"' is missing in BS cell!\n", i);
return(0);
}
}
return(1);
}
/****************************************************************************/
/* Creation de la structure de donnees associee au fichier informations */
static int CreerInfos(vbe)
struct befig *vbe;
{
int i = 0;
int j = 0;
int lg_bs = 0;
int lg_inst_bs = 0;
int inst_bs = 0;
int cel_bs = 0;
int indice = 0;
struct begen *gen;
if(!InitStruct()) {
fprintf(stderr,"Error!\n");
return(0);
}
for(gen = vbe -> BEGEN; gen; gen = gen -> NEXT) {
if(*gen -> TYPE == 'n') {
/*parseur de la ligne pour la taille du registre instruction*/
if(!strcmp(gen->NAME, "bs_instruction_length")) {
if(lg_inst_bs) {
fprintf(stderr,"duplicate 'instruction_length' !\n");
return(0);
}
InfosVbe->lg_inst = *(long*)gen -> VALUE;
lg_inst_bs = 1;
}
/*parseur de la ligne pour la taille de la chaine boundary scan*/
else if(!strcmp(gen->NAME, "bs_length")) {
if(lg_bs) {
fprintf(stderr,"duplicate 'bs_length' !\n");
return(0);
}
InfosVbe->lg_bs = *(long*)gen -> VALUE;
lg_bs = 1;
}
else {
fprintf(stdout,"Instruction '%s' unknown!\n",gen->NAME);
return(0);
}
}
/*parseur de la ligne pour la liste des instructions*/
else if(*gen -> TYPE == 's') {
if(!strcmp(gen->NAME, "bs_instructions")) {
if(inst_bs) {
fprintf(stderr,"duplicate 'bs_instructions' !\n");
return(0);
}
if(!CodeOpInst(gen -> VALUE)) {
fprintf(stderr,"Error!\n");
return(0);
}
inst_bs = 1;
}
/*parseur des lignes de description de la chaine BS*/
/*commence par BS_i.........*/
else if(gen->NAME[0] == 'b' && gen->NAME[1] == 's' && gen->NAME[2] == '_') {
for(i = 3; i < strlen(gen->NAME); i++) {
if(gen->NAME[i] >= '0' && gen->NAME[i] <= '9')
indice = indice * 10 + (gen->NAME[i] - '0');
else {
fprintf(stderr,"%s index unknown!\n",gen->NAME);
return(0);
}
}
CelCourante = InfosVbe -> cel;
i = 0;
while(i < indice) {
if(CelCourante -> suivant == NULL) {
CelCourante -> suivant = (Cellules*)mbkalloc(sizeof(Cellules));
if(CelCourante -> suivant == NULL) {
fprintf(stderr,"Out of memory!\n");
exit(1);
}
CelCourante -> suivant -> nom = NULL;
for(j = 0; j < 5; j++)
CelCourante -> suivant -> donnees[j] = -1;
CelCourante -> suivant -> suivant = NULL;
CelCourante = CelCourante -> suivant;
}
else
CelCourante = CelCourante -> suivant;
i++;
}
indice = 0;
if(CelCourante -> nom == NULL) {
if(!CelluleBS(gen->VALUE)) {
fprintf(stderr,"Error!\n");
return 0;
}
}
else {
fprintf(stderr,"duplicate cell %s!\n",gen->NAME);
return(0);
}
cel_bs = 1;
}
else {
fprintf(stderr,"Instruction unknown!\n");
return(0);
}
}
else {
fprintf(stderr,"instruction type unknown!\n");
return(0);
}
}
if(!lg_bs) {
fprintf(stderr,"file incomplete\n");
fprintf(stderr,"BS register size is missing!\n");
return(0);
}
if(!lg_inst_bs) {
fprintf(stderr,"file incomplete\n");
fprintf(stderr,"instruction register size is missing!\n");
return(0);
}
if(!inst_bs) {
fprintf(stderr,"file incomplete\n");
fprintf(stderr,"BS instructions are missing!\n");
return(0);
}
if(!cel_bs) {
fprintf(stderr,"file incomplete\n");
fprintf(stderr,"BS cells are missing!\n");
return(0);
}
i = 0;
for(CelCourante = InfosVbe -> cel; CelCourante; CelCourante = CelCourante -> suivant) {
if(CelCourante -> nom == NULL) {
fprintf(stderr,"the cell with the index %d is missing!\n", i);
return(0);
}
i++;
}
return(1);
}
/****************************************************************************/
/*construction de la variable globale InfosVbe*/
/*Rq: on ne peut que decrire qu'un seul ensemble boundary scan malgre la presence d'un champ next dans la structure. Avec quelques modifications dans le parseur et dans la construction de la var. , on peut changer cet etat de faits.*/
int ReadBSDL(name)
char *name;
{
FILE *test;
struct befig *vbe=NULL;/*structure formee a partir du parsing du fichier bsdl*/
putenv("VH_BEHSFX=bsdl");
fprintf(stdout,"Loading BSDL file %s.bsdl...", name);
fflush(stdout);
/*test d'existence du fichier*/
test=fopen(concat(name,".bsdl"),"r");
if (ferror(test)!=0) {
fprintf(stderr,"Unable to load %s.bsdl\n",name);
return 1;
}
fclose(test);
/*chargement du fichier*/
vbe = vhdlloadbefig(NULL,name,0);
if(vbe==NULL || vbe -> ERRFLG != 0) {
fprintf(stderr,"Unable to load %s.bsdl\n",name);
return(1);
}
if(vbe -> BEGEN != NULL) {
/* Creation de la structure de donnees associees au fichier informations */
fprintf(stdout,"Analysing BSDL file %s.bsdl\n", name);
if(!CreerInfos(vbe)) {
return(1);
}
}
else {
fprintf(stderr,"Cannot find BSDL informations in %s.bsdl\n",name);
return(1);
}
return(0);
}
/****************************************************************************/
/* Visualise la structure de donnees associee au fichier informations */
void AfficheInfos(infos)
Infos infos;
{
Instructions *ICourant;
Codes *ICourantCode;
Cellules *CCourant;
fprintf(stdout,"Informations file vbe :\n");
fprintf(stdout,"\tLength Instruction : %d\n", infos.lg_inst);
fprintf(stdout,"\tInstructions :\n");
ICourant = infos.inst;
while(ICourant != NULL) {
fprintf(stdout,"\t\tName : %s\n", (char*)(ICourant -> nom));
ICourantCode = ICourant -> code;
fprintf(stdout,"\t\tCodes :\n");
while(ICourantCode != NULL) {
fprintf(stdout,"\t\t\tValue : %s\n", (char*)ICourantCode -> valeur);
ICourantCode = ICourantCode -> suivant;
}
fprintf(stdout,"\n");
ICourant = ICourant -> suivant;
}
fprintf(stdout,"\tLength BS : %d\n", infos.lg_bs);
getchar();
fprintf(stdout,"\tCells :\n");
CCourant = infos.cel;
while(CCourant != NULL) {
fprintf(stdout,"\t\tName : %s\n", CCourant -> nom);
if(CCourant -> donnees[DMODE] == -1)
fprintf(stdout,"\t\tMode : *\n");
else if(CCourant -> donnees[DMODE] == INPUT)
fprintf(stdout,"\t\tMode : INPUT\n");
else if(CCourant -> donnees[0] == OUTPUT3)
fprintf(stdout,"\t\tMode : OUTPUT3\n");
else if(CCourant -> donnees[DMODE] == OUTPUT2)
fprintf(stdout,"\t\tMode : OUTPUT2\n");
else if(CCourant -> donnees[DMODE] == CONTROL)
fprintf(stdout,"\t\tMode : CONTROL\n");
else
fprintf(stdout,"\t\tMode : CLOCK\n");
if(CCourant -> donnees[DDEFAUT] == -1)
fprintf(stdout,"\t\tDefault : *\n");
else
fprintf(stdout,"\t\tDefault : %d\n", CCourant -> donnees[DDEFAUT]);
if(CCourant -> donnees[DCONTROLE] == -1)
fprintf(stdout,"\t\tControl : *\n");
else
fprintf(stdout,"\t\tControl : %d\n", CCourant -> donnees[DCONTROLE]);
if(CCourant -> donnees[DCOMMANDE] == -1)
fprintf(stdout,"\t\tCommand : *\n");
else
fprintf(stdout,"\t\tCommand : %d\n", CCourant -> donnees[DCOMMANDE]);
if(CCourant -> donnees[DINVERSION] == -1)
fprintf(stdout,"\t\tInversion : *\n");
else if(CCourant -> donnees[DINVERSION] == 1)
fprintf(stdout,"\t\tInversion : OUI\n");
else
fprintf(stdout,"\t\tInversion : NON\n");
CCourant = CCourant -> suivant;
fprintf(stdout,"\n");
getchar();
}
}
/****************************************************************************/
/****************************************************************************/

View File

@ -0,0 +1,7 @@
/****************************************************************************/
/* creer une structure info a partir du fichier name*/
int ReadBSDL(char *name);
/****************************************************************************/
/* Visualise la structure de donnees associee au fichier informations */
void AfficheInfos(Infos infos);
/****************************************************************************/

View File

@ -0,0 +1,61 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Francois DONNET (1998) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
%{
#include "global.h"
#include "yyy.h"
extern int NBR_LIGNES;
%}
nbr (([1-9][0-9]*)|0)
/*les noms en vhdl ne peuvent avoir plusieurs tirets consecutifs, de plus ils ne peuvent finir par un tiret*/
mot ([a-zA-Z](_?[a-zA-Z0-9])*)
lettre ([a-zA-Z])
%%
[ \t] ;
\n {NBR_LIGNES++;}
[pP][cC][bB][sS]/[ \t\n]+{mot} {return _PCBS;}
[vV]([eE][rR][sS][iI][oO][nN])?/[ \t\n]*{nbr}\. {return Version;}
[iI][nN] {return _IN;}
[oO][uU][tT] {return _OUT;}
[iI][nN][oO][uU][tT] {return _INOUT;}
[;]+ {return Pt_virg;}
: {return Db_pt;}
\<\= {return Assign;}
\( {return Par_ouv;}
\] {return Cro_fer;}
\) {return Par_fer;}
\[ {return Cro_ouv;}
{lettre}/[ \t\n]*: {/*remarque: le [ \t\n]*: n'est pas parse*/
yylval.lettre=(char)tolower(yytext[0]);
/*reservation espace memoire cf. MUT_H*/
return Lettre;}
{mot} {yylval.mot=(char*)namealloc(yytext);
/*reservation espace memoire cf. MUT_H*/
return Mot;}
{nbr}\.{nbr} {yylval.flottant=atof(yytext);
/*reservation espace memoire cf. MUT_H*/
return Num_version;}
{nbr}/[ \t\n]*[\]\)] {/*remarque: [ \t\n]*[\)\]] n'est pas parse*/
yylval.mot=(char*)namealloc(yytext);
/*reservation espace memoire cf. MUT_H*/
return Index;}
{nbr} {yylval.val=atoi(yytext);
return Nbr;}
\-\-.* ;
. {return *yytext;}
%%
int yywrap(){return 1;}

View File

@ -0,0 +1,269 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Francois DONNET (1998) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
#include "global.h"
extern FILE *emul_in; /*communication avec le emul.yac*/
extern FILE *pga_in; /*communication avec le pga.yac*/
extern Infos *InfosVbe; /*resultat final du parseur*/
int FLAG_ERR=0; /*si une erreur est arrivee*/
int NBR_LIGNES=1; /*pour message d'erreur*/
Cellules *EMUL[PCBS_NBR_EMULBS*NBR_CELLS]; /*lien entre n° et EMUL*/
ht *HSH_DATA; /*lien entre PGA et EMUL*/
ht *HSH_VSS; /*lien entre PGA et Vss*/
ht *HSH_VDD; /*lien entre PGA et Vdd*/
extern void pga_parse();
extern void emul_parse();
/* charge le fichier de description de la chaine boundary scan
carte_emul--> nom fichier connexions PGA / EMULBS
et retourne...
0 ---> pas d'erreur le resultat est dans la variable globale InfosVbe
(cf. globale.h)
-1 ---> erreur de chargement du fichier emul
-2 ---> erreur de chargement du fichier pga
1 ---> warnings*/
int description_cartes(char *emul,char *pga)
{
emul_in=fopen(emul,"r");
if (ferror(emul_in)!=0) {
fprintf(stderr,"Unable to load %s\n",emul);
return -1;
}
/*creer les n EMULBS31 avec des donnees vides*/
creer_infos();
HSH_DATA=(ht*)addht(PCBS_NBR_EMULBS*NBR_CELLS);
HSH_VDD=(ht*)addht(NBR_LIGNES_PGA*NBR_COLONNES_PGA-PCBS_NBR_EMULBS*NBR_CELLS);
HSH_VSS=(ht*)addht(NBR_LIGNES_PGA*NBR_COLONNES_PGA-PCBS_NBR_EMULBS*NBR_CELLS);
fprintf(stdout,"Loading file %s...", emul);
fflush(stdout);
emul_parse(); /*appel a LEX&YACC->carte_emul.yac,carte_emul.lex*/
fclose(emul_in);
if (FLAG_ERR<0)
{delht(HSH_DATA);delht(HSH_VDD);delht(HSH_VSS);return -1;}
pga_in=fopen(pga,"r");
if (ferror(pga_in)!=0) {
fprintf(stderr,"Unable to load %s\n",pga);
delht(HSH_DATA);delht(HSH_VDD);delht(HSH_VSS);
return -2;
}
fprintf(stdout,"Loading file %s...", pga);
fflush(stdout);
pga_parse(); /*appel a LEX&YACC->carte_emul.yac,carte_emul.lex*/
fclose(pga_in);
delht(HSH_DATA);delht(HSH_VDD);delht(HSH_VSS);
if (FLAG_ERR<0) return -2;
return FLAG_ERR;
}
/********************************* InfosVbe **********************************/
/* affichage de la variable globale InfosVbe*/
void affich_infos()
{
Infos *inf=InfosVbe; /*variable globale cf. pcbs.h*/
Instructions *ins;
Codes *cod;
Cellules *cell;
int i=0;
while (inf!=NULL){
fprintf(stdout,"\n************************** boundary scan chain n°%d **************************\n",i++);
fprintf(stdout,"instruction register length=%d\t",inf->lg_inst);
ins=inf->inst;
while (ins!=NULL) {
fprintf(stdout,"%s( ",ins->nom);
cod=ins->code;
while (cod!=NULL) {
fprintf(stdout,"%s ",cod->valeur);
cod=cod->suivant;
}
fprintf(stdout,") ");
ins=ins->suivant;
}
fprintf(stdout,"\n\n");
cell=inf->cel;
while (cell!=NULL) {
switch (cell->donnees[DMODE]) {
case OUTPUT2:case OUTPUT3:fprintf(stdout,"out %s; ",cell->nom);break;
case INPUT:fprintf(stdout,"in %s; ",cell->nom);break;
case INOUTPUT:fprintf(stdout,"inout %s; ",cell->nom);break;
}
cell=cell->suivant;
}
fprintf(stdout,"\n");
inf=inf->next;
}
fprintf(stdout,"\n");
}
/* suppression en memoire de la variable globale InfosVbe*/
void del_infos()
{
Infos *inf2,*inf=InfosVbe; /*variable globale cf. pcbs.h*/
Instructions *ins,*ins2;
Codes *cod,*cod2;
Cellules *cell,*cell2;
while (inf!=NULL){
ins=inf->inst;
while (ins!=NULL) {
cod=ins->code;
while (cod!=NULL) {
cod2=cod;
cod=cod->suivant;
mbkfree(cod2);
}
ins2=ins;
ins=ins->suivant;
mbkfree(ins2);
}
cell=inf->cel;
while (cell!=NULL) {
cell2=cell;
cell=cell->suivant;
mbkfree(cell2);
}
inf2=inf;
inf=inf->next;
mbkfree(inf2);
}
InfosVbe=NULL;
}
/********** allocation memoire pour la variable globale InfosVbe *************/
/*construire la structure INSTRUCTIONS acceptees par EMUL31*/
static Instructions *creer_inst()
{
/*bypass*/
Instructions *j,*i=(Instructions*) mbkalloc(sizeof(Instructions));
if (i==NULL) {fprintf(stderr,"Not enough memory!");exit(1);}
i->nom=(char*)namealloc("BYPASS");
i->code=(Codes*) mbkalloc(sizeof(Codes));
if (i->code==NULL) {fprintf(stderr,"Not enough memory!");exit(1);}
i->code->valeur=(char*) namealloc(_BYPASS0);
i->code->suivant=(Codes*) mbkalloc(sizeof(Codes));
if (i->code->suivant==NULL) {fprintf(stderr,"Not enough memory!");exit(1);}
i->code->suivant->valeur=(char*) namealloc(_BYPASS1);
i->code->suivant->suivant=NULL;
/*intest*/
i->suivant=(Instructions*) mbkalloc(sizeof(Instructions));
j=i->suivant;
if (j==NULL) {fprintf(stderr,"Not enough memory!");exit(1);}
j->nom=(char*)namealloc("INTEST");
j->code=(Codes*) mbkalloc(sizeof(Codes));
if (j->code==NULL) {fprintf(stderr,"Not enough memory!");exit(1);}
j->code->valeur=(char*) namealloc(_INTEST);
j->code->suivant=NULL;
/*config*/
j->suivant=(Instructions*) mbkalloc(sizeof(Instructions));
j=j->suivant;
if (j==NULL) {fprintf(stderr,"Not enough memory!");exit(1);}
j->nom=(char*)namealloc("CONFIG");
j->code=(Codes*) mbkalloc(sizeof(Codes));
if (j->code==NULL) {fprintf(stderr,"Not enough memory!");exit(1);}
j->code->valeur=(char*) namealloc(_CONFIG);
j->code->suivant=NULL;
j->suivant=NULL;
return i;
}
/*construire toutes les cellules des chaines BS des n EMUL31
---> resultat dans la variable globale TAB_EMUL[][] */
static Cellules* creer_cellules()
{
static int i=0; /*pour le rangement dans la variable globale EMUL[] */
int taille=sizeof(Cellules);
int j;
Cellules *tab[NBR_CELLS];
char *nom_cell=(char*) namealloc("*");
for (j=0;j<NBR_CELLS;j++) { /*nbr de cells d'une chaine BS */
tab[j]=(Cellules*) mbkalloc(taille);
if (tab[j]==NULL) {
fprintf(stderr,"Not enough memory!");
exit(1);
}
if (j>0) tab[j-1]->suivant=tab[j];
tab[j]->nom= nom_cell;
/*le premier n'a pas de precedent*/
tab[j]->donnees[DINVERSION]= 0;
/*0: pas d'inversion 1: inversion*/
tab[j]->donnees[DCONTROLE]= UNDEF;
/*UNDEF=-1: la cell n'est pas de controle*/
/*n°: index de la cellule controlee*/
tab[j]->donnees[DDEFAUT]= UNDEF;
/*UNDEF=-1: la cell n'est pas de controle n°: valeur par defaut*/
tab[j]->donnees[DCOMMANDE]= UNDEF;
/*UNDEF=-1: la cell n'est pas controlee*/
/*0 ou 1: valeur de la commande active*/
tab[j]->donnees[DMODE]= UNDEF;
/* UNDEF-->cellule non-active qui sera 'enlevee' de la chaine*/
/* cf. global.h et output.c*/
EMUL[i++]=tab[j];
/* chargement en variable globale dans EMUL[] */
}
tab[j-1]->suivant=NULL; /*le dernier n'a pas de suivant*/
return tab[0];
}
/*creer les n EMUL31 chaines*/
void creer_infos()
{
Infos *inf[PCBS_NBR_EMULBS];
int i;
for (i=0;i<PCBS_NBR_EMULBS;i++) { /*faire une chaine de n EMUL31*/
inf[i]=(Infos*)mbkalloc(sizeof(Infos));
if (inf[i]==NULL) {fprintf(stderr,"Not enough memory!");exit(1);}
inf[i]->lg_inst=INS_LEN;
/*taille du registre instruction de la carte EMULBS 31*/
inf[i]->inst=creer_inst(); /*liste des instructions acceptees*/
inf[i]->cel=creer_cellules(); /*chaine boundary-scan*/
inf[i]->lg_bs=NBR_CELLS; /*longueur de la chaine*/
if (i>0) inf[i-1]->next=inf[i]; /*le premier n'a pas de precedent*/
}
inf[i-1]->next=NULL; /*le dernier n'a pas de suivant*/
InfosVbe= inf[0];
}
/*****************************************************************************/
/******************************* END OF FILE *********************************/
/*****************************************************************************/

View File

@ -0,0 +1,25 @@
/*****************************************************************************/
/* charge le fichier de description de la chaine boundary scan
carte_emul--> nom fichier connexions PGA / EMULBS et retourne...
0 ---> pas d'erreur le resultat est dans la variable globale InfosVbe
(cf. globale.h)
-1 ---> erreur de chargement du fichier emul
-2 ---> erreur de chargement du fichier pga
1 ---> warnings*/
int description_cartes(char *emul,char *pga);
/*creer les n EMUL31 chaines*/
void creer_infos();
/* affichage de la variable globale InfosVbe*/
void affich_infos();
/* suppression en memoire de la variable globale InfosVbe*/
void del_infos();
/*****************************************************************************/
/******************************* END OF FILE *********************************/
/*****************************************************************************/

View File

@ -0,0 +1,319 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Philippe OLEK, Olivier SIROL (1995) ##*/
/*## Authors : Eric MECHIN (1996) ##*/
/*## Authors : Francois DONNET (1998) ##*/
/*## ##*/
/*## Modifications : Ana ABRIL (2000) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
/****************************************************************************/
#include "global.h"
/****************************************************************************/
/* Variables globales */
/****************************************************************************/
Infos *InfosVbe=NULL; /* Pour les informations */
/* flags and vars for command line processing */
int verbose_flag = 0; /*affichage de tous les commmentaires */
int execute_flag = 0; /*mode avec hardware */
int savePatSRC_flag = 0; /*sauvegardr pattern // */
int savePatBS_flag = 0; /*sauvegarder pattern BS */
int check_flag = 0; /*est-ce le mode check */
int emulbs_flag = 0; /*est-ce pour l'interface EMULBS31? */
static int bsdl_flag = 0; /*bsdl description */
static int patlimit_flag = 0; /*nbr de patterns dans une sequence */
static char *sce=NULL,*destSRC=NULL,*destBS=NULL,*bsdl=NULL,*emu=NULL,*pga=NULL;
static unsigned int pat_limit=PAT_LIMIT;
/****************************************************************************/
/****************************************************************************/
/* Aide sur la ligne de commande */
static void usage()
{
fprintf(stdout,"\
%s version %s :\n\
%s --help\n\
%s [ -hvcxeb ] [ -p [all|<number>] ] [ <description files> ]\n\
[ <source.PAT> ] [ [-fs] <destination.PAT> ]\n\
",PROGRAM_NAME,PCBS_VERSION,PROGRAM_NAME,PROGRAM_NAME);
}
/****************************************************************************/
static void help()
{
fprintf(stdout,"\
%s version %s :\n\
%s [ -hvcxeb ] [ -p [all|<number>] ] [ <description files> ]\n\
[ <source.PAT> ] [ [-fs] <destination.PAT> ]\n\
-h,--help\tDisplay this current message.\n\
-v,--verbose\tDisplay all warnings and actions.\n\
-p,--pattern\tMust be followed by the <number> (or \"all\") of patterns %s\n\
\t\twill treat in one sequence. If you have memory problems put the\n\
\t\tpatterns number lower than the default value %d. You can also\n\
\t\traise it up.\n\
-s,--serial\tKind of patterns to be saved. Take the boundary scan serial\n\
\t\tform. Beware destination file size is many times source size!\n\
-f,--functionnal\tKind of patterns to be saved. Keep the functionnal form of the\n\
\t\tpattern source file.\n\
-c,--check\tCheck the boundary scan hardware. It can be followed by a\n\
\t\tdescription to compare the file with the hardware.\n\
-e,--emulbs,-b,--bsdl\n\
\t\tTraduce functionnal patterns into boundary scan patterns. These\n\
\t\toptions need both functionnal pattern file for <source> and\n\
\t\toptionnaly a <destination> file to keep results. The difference\n\
\t\tis in <description files>. If there is an EMULBS31 interface\n\
\t\tcard on the DUT, you must use --emulbs option. If you don't have\n\
\t\tsuch card, put --bsdl option.\n\
\t\t\t--emulbs <emulbs_connexions> <pga_connexions>\n\
\t\t\t--bsdl <description.BSDL>\n\
\t\tsee manual page for more information.\n\
-x,--execute\tSend boundary scan patterns to the DUT hardware. It can be\n\
\t\tcombinated with -e or -b options.
",PROGRAM_NAME,PCBS_VERSION,PROGRAM_NAME,PROGRAM_NAME,PAT_LIMIT);
}
/******************************************************************************/
/* set variables to values of command line */
/******************************************************************************/
static void set_param(int argc, char* argv[])
{
int i;
if ( argc <= 1 )
{
usage();
exit(0);
}
/*verify for Sun and Solaris. getopt() isn't the same than Linux_elf */
for ( i=1; i<argc; i++ )
{
if ( !strcmp(argv[i],"-h") || !strcmp(argv[i],"--usage") )
{
help();
exit(0);
}
if ( !strcmp(argv[i],"-v") || !strcmp(argv[i],"--verbose") )
{
verbose_flag = 1;
continue;
}
if ( !strcmp(argv[i],"-c") || !strcmp(argv[i],"--check") )
{
check_flag = 1;
continue;
}
if ( !strcmp(argv[i],"-x") || !strcmp(argv[i],"--execute") )
{
execute_flag=1;
continue;
}
if ( !strcmp(argv[i],"-b") || !strcmp(argv[i],"--bsdl") )
{
bsdl_flag=1;
if (++i>=argc) {
usage();
exit(1);
}
bsdl = argv[i];
continue;
}
if ( !strcmp(argv[i],"-e") || !strcmp(argv[i],"--emulbs") )
{
emulbs_flag=1;
if (++i>=argc) {
usage();
exit(1);
}
emu = argv[i];
if (++i>=argc) {
usage();
exit(1);
}
pga = argv[i];
continue;
}
if ( !strcmp(argv[i],"-f") || !strcmp(argv[i],"--functionnal") )
{
savePatSRC_flag=1;
if (++i>=argc) {
usage();
exit(1);
}
destSRC = argv[i];
continue;
}
if ( !strcmp(argv[i],"-s") || !strcmp(argv[i],"--serial") )
{
savePatBS_flag=1;
if (++i>=argc) {
usage();
exit(1);
}
destBS = argv[i];
continue;
}
if ( !strcmp(argv[i],"-p") || !strcmp(argv[i],"--pattern") )
{
patlimit_flag=1;
if (++i>=argc) {
usage();
exit(1);
}
if ( !strcmp("all",argv[i]) ) pat_limit=0;
else pat_limit=atoi(argv[i]);
continue;
}
if ( argv[i][0]=='-' ) /*invalid option*/
{
fprintf(stderr, "Invalid option '%s'\n", argv[i]);
usage();
exit(1);
}
/*sources*/
if (!sce)
{
sce=argv[i];
continue;
}
/*destination optionnelle si...*/
if (( execute_flag || emulbs_flag||bsdl_flag )&& !savePatSRC_flag)
{
savePatSRC_flag=1;
destSRC=argv[i];
continue;
}
if (!savePatBS_flag)
{
savePatBS_flag=1;
destBS=argv[i];
continue;
}
usage();
exit(1);
}
/****COHERENCE****/
if ( destSRC && destBS && !strcmp(destSRC,destBS)) {
fprintf(stdout,"same name %s for two destination files!\n",destBS);
usage();pcbs_exit(0);}
/*impossible produire patterns paralleles corriges sans hardware*/
if (savePatSRC_flag && !execute_flag) {
fprintf(stderr,"'-f' option needs '-x'!\n");
usage();pcbs_exit(0);}
/*impossible produire les patterns paralleles sans ceux d'origine*/
if (savePatSRC_flag && !emulbs_flag && !bsdl_flag) {
fprintf(stderr,"'-f' option needs '-e' or '-b'!\n");
usage();pcbs_exit(0);}
/*emulation*/
if (emulbs_flag) {
if (bsdl_flag) {
fprintf(stderr,"'-e' option doesn't match with '-b'!\n");
usage();pcbs_exit(0);}
if (!check_flag&&!execute_flag && !savePatSRC_flag && !savePatBS_flag) {
fprintf(stderr,"'-e' option needs a destination!\n");
usage();pcbs_exit(0);}
}
/*bsdl*/
else if (bsdl_flag) {
if (!execute_flag && !savePatSRC_flag && !savePatBS_flag) {
fprintf(stderr,"'-b' option needs a destination!\n");
usage();pcbs_exit(0);}
}
/*execution*/
else if (execute_flag) {
if (!execute_flag && !savePatSRC_flag && !savePatSRC_flag) {
fprintf(stderr,"'-b' option needs a destination!\n");
usage();pcbs_exit(0);}
}
/*check*/
else if (check_flag) {
}
/*aucune option*/
else {usage();pcbs_exit(0);}
}
/****************************************************************************/
int main(int argc, char *argv[])
{
/****initialisation environnement****/
mbkenv();
initializeBdd(SMALL_BDD); /*SMALL_BDD=0*/
error_signal_handler(); /*interruptions*/
alliancebanner_with_authors("PcBs", PCBS_VERSION " [2002/02/18]",
"PC/Boundary-Scan Tester Platform",
"2000", ALLIANCE_VERSION,
"Ana ABRIL, François DONNET, Eric MECHIN, Philippe OLEK");
/*take parameters*/
set_param( argc, argv);
/*meme source et destination*/
if (destSRC!=NULL && destBS!=NULL && !strcmp(destSRC,destBS)) {
fprintf(stderr,"%s represents two destination files!\n",destSRC);
usage();pcbs_exit(0);}
if (destSRC!=NULL && sce!=NULL && !strcmp(destSRC,sce)) {
fprintf(stderr,"%s represents a source and a destination file!\n",sce);
usage();pcbs_exit(0);}
if (sce!=NULL && destBS!=NULL && !strcmp(sce,destBS)) {
fprintf(stderr,"%s represents a source and a destination file!\n",sce);
usage();pcbs_exit(0);}
/****traitement****/
/* Chargement de la description du boundary scan */
if (bsdl_flag && ReadBSDL(bsdl)) pcbs_exit(1);
if (emulbs_flag && description_cartes(emu,pga)<0) pcbs_exit(1);
if ((emulbs_flag || bsdl_flag) && VerificationsInfos()) pcbs_exit(1);
/*verification hardware*/
if (check_flag || execute_flag) {
fprintf(stdout,"Checking DUT connected to %s\n",
(char*) current_lpscan_device());
if (check_mode()) pcbs_exit(1);
}
/*sans traduction*/
if (execute_flag && !emulbs_flag && !bsdl_flag)
{if (send_pat_file(sce,destBS,pat_limit)) pcbs_exit(1);pcbs_exit(0);}
/*avec traduction*/
if (execute_flag) open_port();
if ((emulbs_flag || bsdl_flag) && traduire(sce,destSRC,destBS,pat_limit))
pcbs_exit(1); /*traduction*/
if (execute_flag) close_port();
pcbs_exit(0);
return 1;
}
/*****************************************************************************/
/******************************** END OF FILE ********************************/
/*****************************************************************************/

View File

@ -0,0 +1,18 @@
/****************************************************************************/
/*nombre de patterns par sequence chargee*/
#define PAT_LIMIT 270
/*les differents modes de fonctionnement*/
#define PCBS_CHECK
#define PCBS_EXECUTE
#define PCBS_BSDL
#define PCBS_EMUL
int main(int argc, char *argv[]);
/****************************************************************************/

View File

@ -0,0 +1,290 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Francois DONNET (1998) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
/***************** parseur etablissant les connections ***********************/
/************************ entre le PGA et le chip ****************************/
/* */
/* parametres: FILE *yyin */
/* ht *HSH_EMUL,*HSH_VDD,*HSH_VSS */
/* resultat : Infos *InfosVbe */
/* erreur : int FLAG_ERR */
/* */
/*****************************************************************************/
/*
--exemple for chip_connexions
--left-hand is for PGA connector
--right-hand is for CHIP connector
pcbs chip_connexions version 2.0;
a:1 <=in ck ;
r:16<=out y ;
d:4 <=in i(0);
d:5 <=in i[1];
g:2 <=inout sh ;
e:6 <=in d_Vdd ;
a:2 <=in d_Vss ;
*/
%{
#include "global.h"
extern int yylex(); /*fct du lexeur pga.lex*/
extern Infos *InfosVbe; /*resultat final du parseur*/
extern int FLAG_ERR; /*si une erreur est arrivee*/
extern NBR_LIGNES; /*pour message d'erreur*/
extern ht *HSH_DATA; /*lien entre PGA et EMUL*/
extern ht *HSH_VSS; /*lien entre PGA et Vss*/
extern ht *HSH_VDD; /*lien entre PGA et Vdd*/
static ht *HSH_PGA_USED; /*connecteurs PGA deja utilises*/
static ht *HSH_CHIP_USED; /*broches du chip deja affectees*/
void pga_flag(int x);
%}
%union {
int val;
float flottant;
char *mot;
char lettre;
}
%token _PCBS
%token Version
%token Num_version
%token _IN
%token _OUT
%token _INOUT
%token Pt_virg
%token Db_pt
%token Assign
%token Index
%token Nbr
%token Mot
%token Lettre
%token Par_ouv Par_fer
%token Cro_ouv Cro_fer
%type <mot> Index
%type <mot> Mot
%type <lettre> Lettre
%type <val> Nbr
%type <val> type
%type <mot> index .index.
%type <flottant> Num_version
%start fichier
%%
fichier
:
{
/*initialisation*/
NBR_LIGNES=1;
FLAG_ERR=0;
}
header
{
HSH_CHIP_USED=addht(PCBS_NBR_EMULBS*NBR_CELLS);
HSH_PGA_USED=addht(NBR_LIGNES_PGA*NBR_COLONNES_PGA);
}
..declarations..
{
/*liberation memoire*/
delht(HSH_CHIP_USED);
delht(HSH_PGA_USED);
}
;
declaration
:Lettre
Db_pt
Nbr
Assign
type
Mot
.index.
Pt_virg
{
char *chip=(char*)concat_espace($6,$7); /*avec un espace*/
char *pga=(char*)concat(ctoa($1),itoa($3));
Cellules *cell;
/****** test du PGA ******/
/* ligne PGA incorrecte */
if ($1<LETTRE_DEB_PGA || $1>LETTRE_FIN_PGA || $1=='i' || $1=='o') {fprintf(stderr,"%d: letter '%c' for a line is forbidden!\n",NBR_LIGNES,$1);pga_flag(-2);break;}
/* colonne PGA incorrecte */
if ($3<NBR_DEB_PGA || $3>NBR_FIN_PGA) {fprintf(stderr,"%d: number '%d' for a column is forbidden!\n",NBR_LIGNES,$3);pga_flag(-2);break;}
/* test de double utilisation d'une broche PGA */
if (gethtitem(HSH_PGA_USED,pga)!=EMPTYHT) {fprintf(stderr,"%d: PGA connector line %c column %d already used!\n",NBR_LIGNES,$1,$3);pga_flag(-2);break;}
else addhtitem(HSH_PGA_USED,pga,1); /*attention EMPTYHT=-1!!!!*/
/***** test du CHIP *****/
/* alimentation Vdd du CHIP */
if (isvdd(chip)) {
if (gethtitem(HSH_VDD,pga)==EMPTYHT) {fprintf(stderr,"%d: power %s isn't connected to Vdd!\n",NBR_LIGNES,chip);pga_flag(-1);break;}
else addhtitem(HSH_CHIP_USED, chip, 1);
}
/* alimentation Vss du CHIP*/
else if (isvss(chip)) {
if (gethtitem(HSH_VSS,pga)==EMPTYHT) {fprintf(stderr,"%d: power %s isn't connected to Vss!\n",NBR_LIGNES,chip);pga_flag(-1);break;}
else addhtitem(HSH_CHIP_USED, chip, 1); /*attention EMPTYHT=-1!!!!*/
}
/* les datas du CHIP */
else if ((cell=(Cellules*)gethtitem(HSH_DATA,pga))==(Cellules*)EMPTYHT) {fprintf(stderr,"%d: data %s isn't connected to the emulator!\n",NBR_LIGNES,chip);pga_flag(-1);break;}
else {
addhtitem(HSH_CHIP_USED, chip, 1); /*attention EMPTYHT=-1!!!!*/
cell->donnees[DMODE]=$5;
cell->nom=chip;
}
}
|error /*gestion des erreurs*/
{/*synchronisation avec point virgule ou fin de fichier*/
while (yychar!=Pt_virg && yychar!=0) yychar=yylex();
yychar=yylex();
yyerrok;}
;
header
:_PCBS
Mot
Version
Num_version
Pt_virg
{
char c;
if (strcmp($2,PGA_FILE_NAME)) {
fprintf(stderr,"%s doesn't recognise it\nDo you want to continue? (y/n) ",PROGRAM_NAME);
fflush(stderr); /*affichage immediat*/
fseek(stdin,0,SEEK_END); /*enlever les anciens caracteres*/
c=getc(stdin);
getc(stdin);
if (c!='y' && c!='Y') {pga_flag(-3);return -1;}
pga_flag(3);
}
if (FLAG_ERR==0 && $4>atof(PCBS_VERSION)) {
fprintf(stderr,"You use an old version of %s\nDo you want to continue? (y/n) ",PROGRAM_NAME);
fflush(stderr); /*affichage immediat*/
fseek(stdin,0,SEEK_END); /*enlever les anciens caracteres*/
c=getc(stdin);
getc(stdin);
if (c!='y' && c!='Y') {pga_flag(-4);return -1;}
pga_flag(4);
}
if (FLAG_ERR==0) fprintf(stdout,"\n"); /*coherence dans l'affichage*/
}
|error /*gestion des erreurs*/
{/*synchronisation avec point virgule ou fin de fichier*/
char c;
while (yychar!=Pt_virg && yychar!=0) yychar=yylex();
yychar=yylex();
yyerrok;
/*demande d'arret*/
fprintf(stderr,"%s doesn't recognise this file\nDo you want to continue? (y/n) ",PROGRAM_NAME);
fflush(stderr); /*affichage immediat*/
fseek(stdin,0,SEEK_END); /*enlever les anciens caracteres*/
c=getc(stdin);
getc(stdin);
if (c!='y' && c!='Y') {emul_flag(-3);return -1;}
FLAG_ERR=3;
}
;
..declarations..
:
|declaration ..declarations..
;
.index.
:index {$$=$1;}
|/*empty*/ {$$=NULL;}
;
index:
Par_ouv
Index
Par_fer
{$$=$2;}
|Cro_ouv
Index
Cro_fer
{$$=$2;}
;
type
:_IN {$$=INPUT;}
|_OUT {$$=OUTPUT2;}
|_INOUT {$$=INOUTPUT;}
;
%%
/**************************** change le FLAG_ERR *****************************/
void pga_flag(int x)
{
/*sauvegarde de la premiere erreur ou du dernier warning*/
if (FLAG_ERR>=0) FLAG_ERR=x;
}
/****************** traitement des erreurs de syntaxe ************************/
int yyerror()
{
fprintf(stderr,"%d: syntax error",NBR_LIGNES);
switch ((int)yychar) {
case Mot: fprintf(stderr," append at '%s'\n",yylval.mot);break;
case Lettre: fprintf(stderr," append at '%s'\n",yylval.mot);break;
case Index: fprintf(stderr," append at '%s'\n",yylval.mot);break;
case Nbr: fprintf(stderr," append at '%d'\n",yylval.val);break;
case Pt_virg: fprintf(stderr," append at ';'\n");break;
case Assign: fprintf(stderr," append at '<='\n");break;
case Db_pt: fprintf(stderr," append at ':'\n");break;
case Cro_ouv: fprintf(stderr," append at '['\n");break;
case Cro_fer: fprintf(stderr," append at ']'\n");break;
case Par_ouv: fprintf(stderr," append at '('\n");break;
case Par_fer: fprintf(stderr," append at ')'\n");break;
case _IN: fprintf(stderr," append at 'in'\n");break;
case _OUT: fprintf(stderr," append at 'out'\n");break;
case _INOUT: fprintf(stderr," append at 'inout'\n");break;
case _PCBS: fprintf(stderr," append at 'pcbs'\n");break;
case Version: fprintf(stderr," append at 'Version'\n");break;
case Num_version:fprintf(stderr," append at '%.1f'\n",yylval.flottant);break;
case 0: fprintf(stderr," ';' is missing\n");break;/*EOF*/
default: fprintf(stderr," for '%c' not allowed!\n",yychar);
}
pga_flag(-1);
return 1;
}
/*****************************************************************************/
/**************************** END of LEX&YACC ********************************/
/*****************************************************************************/

View File

@ -0,0 +1,60 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Philippe OLEK, Olivier SIROL (1995) ##*/
/*## Authors : Eric MECHIN (1996) ##*/
/*## Authors : Olivier FLORENT (1997) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
#include "global.h"
/*****************************************************************************/
/*fermer les ports, desallouer la memoire et exit*/
void pcbs_exit(code)
int code;
{
del_infos();
close_port();
exit(code);
}
/*****************************************************************************/
/*sortie avec message sur interruption*/
void emergency(sig)
int sig;
{
char nomsig[24];
switch (sig) {
case SIGTERM : strcpy(nomsig,"SIGTERM"); break ;
case SIGINT : strcpy(nomsig,"SIGINT "); break ;
case SIGBUS : strcpy(nomsig,"SIGBUS "); break ;
case SIGSEGV : strcpy(nomsig,"SIGSEGV"); break ;
default : strcpy(nomsig,"(???)") ; break;
}
fprintf(stderr,"#### Emergency OUTPUT on signal %s ...\n",nomsig);
pcbs_exit(-1);
}
/*****************************************************************************/
/*mise en place des interruptions*/
void error_signal_handler()
{
signal(SIGTERM ,emergency);
signal(SIGINT ,emergency);
signal(SIGBUS ,emergency);
signal(SIGSEGV ,emergency);
}
/*****************************************************************************/
/******************************* END OF FILE *********************************/
/*****************************************************************************/

View File

@ -0,0 +1,10 @@
/*****************************************************************************/
/*fermer les ports, desallouer la memoire et exit*/
void pcbs_exit(int code);
/*sortie avec message sur interruption*/
void emergency(int sig);
/*mise en place des interruptions*/
void error_signal_handler();
/*****************************************************************************/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
/* Structure de donnees pour les vecteurs Boundary Scan */
typedef struct Data {
char ancien, courant; /* Vecteur precedent et courant */
int index; /* Indexe de la cellule par rapport a la structure */
char *nom; /* nom */
Cellules *cel; /* de donnees informations, mode de la cellule */
/* (entree ou sortie) */
} Data;
/****************************************************************************/
/* Creation des vecteurs Boundary Scan en n sequences*/
int traduire(char *sce, char *destSRC, char *destBS, unsigned int sequence);
/****************************************************************************/

View File

@ -0,0 +1,60 @@
/*********** Donnees relatives a la cellule Boundary Scan *******************/
#define DMODE 0 /* INPUT, OUTPUT2, OUTPUT3,INOUTPUT, CONTROL et CLOCK */
#define DDEFAUT 1 /* Pour les cellules de mode CONTROL, valeur par default */
/*pour mettre en haute impedance l'OUTPUT3 auquel il est rattache*/
#define DCONTROLE 2 /* Si cellule 3 etats, Index de la cellule qui la */
/* controle */
#define DCOMMANDE 3 /* Valeur pour activer la sortie d'un OUTPUT3 */
#define DINVERSION 4 /* Cellule inverseuse (1) ou non inverseuse (0) */
/******************* Modes des cellules Boundary Scan ************************/
/* valeur du champ donnees[DMODE] */
#define UNDEF -1 /* non-defini, equivalent a '*' */
#define INPUT 0 /* Entree */
#define OUTPUT3 1 /* Sortie 3 etats */
#define OUTPUT2 2 /* Sortie 2 etats */
#define CONTROL 3 /* Controle d'une sortie 3 etats */
#define CLOCK 4 /* Horloge */
#define INOUTPUT 5 /* Inout connector */
/****************************************************************************/
/* Liste des codes de l'instruction Boundary Scan */
typedef struct Codes {
char *valeur;
struct Codes *suivant;
} Codes;
/* Liste des instructions Boundary Scan */
typedef struct Instructions {
char *nom; /* Nom de l'instruction */
Codes *code; /* Liste des codes pour une instruction */
struct Instructions *suivant;
} Instructions;
/* Liste des cellules formant le registre Boundary Scan */
typedef struct Cellules {
char *nom; /* Nom de la cellule */
int donnees[5]; /* Donnees sur la cellule :
le mode,
valeur par defaut des cellules de type controle,
libelle de la cellule de controle,
valeur de commande,
indicateur de cellule inverseuse ou non inverseuse */
struct Cellules *suivant;
} Cellules;
/* Structure de donnees tirees du fichier informations */
typedef struct Infos {
struct Infos *next; /*pointeur sur un autre circuit Boudary Scan*/
int lg_inst; /* Longueur du registre instruction */
Instructions *inst; /* Liste des instructions */
int lg_bs; /* Longueur du registre Boundary Scan*/
Cellules *cel; /* Liste des cellules du registre Boundary Scan */
} Infos;
/****************************************************************************/
/******************************* END OF FILE *********************************/
/*****************************************************************************/

View File

@ -0,0 +1,396 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Philippe OLEK, Olivier SIROL (1995) ##*/
/*## Authors : Eric MECHIN (1996) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
/****************************************************************************/
#include "global.h"
/****************************************************************************/
/****************************************************************************/
/* Calcul base elevee a la puissance exposant */
int pow(base, exposant)
int base;
int exposant;
{
int i,resultat=1;
for (i=0;i<exposant;i++) resultat=resultat*base;
return(resultat);
}
/****************************************************************************/
/* Copie s dans dupchaine */
char *dupchaine(s)
char *s;
{
char *p;
if (s==NULL) return NULL;
p = (char *) mbkalloc(strlen(s) + 1);
if (p != NULL) strcpy(p, s);
return p;
}
/*****************************************************************************/
/*concatene deux chaines en allouant un nouvel espace memoire dans l'environnement mbk de la facon suivante: s1 + ' ' + s2 ------>impossible a desallouer*/
char *concat_espace(char *s1,char *s2)
{
char *res,*mbk_res;
int t_s1,t_s2,t_res;
int i=0,j=0;
/*tests chaines vides*/
if (s2==NULL && s1==NULL) return NULL;
if (s1==NULL || *s1=='\0') return namealloc(s2);
if (s2==NULL || *s2=='\0') return namealloc(s1);
t_s1=strlen(s1);
t_s2=strlen(s2);
t_res=t_s1+t_s2+2;
/* 2 --> espace entre s1 et s2 plus le '\0' de fin de chaine*/
res=(char*) mbkalloc(t_res);
if (res==NULL) {fprintf(stderr,"Not enough memory!");exit(1);}
for (i=0;i<t_s1;i++) res[i]=s1[i];
res[i++]=' '; /* 1 espace entre s1 et s2! */
for (;i<t_res;i++) res[i]=s2[j++];
res[i]='\0'; /*fin de la chaine*/
mbk_res=namealloc(res);
mbkfree(res);
return mbk_res;
}
/*****************************************************************************/
/*remplace tous les espaces d'un mot par des '_' ------> ne peut pas etre desallouer!! */
char *del_espace(char *s)
{
char *res,*mbk_res;
int i=0;
/*tests chaines vides*/
if (s==NULL || *s=='\0') return namealloc(s);
res=(char*) mbkalloc(strlen(s)+1);
if (res==NULL) {fprintf(stderr,"Not enough memory!");exit(1);}
for (i=0;i<=strlen(s);i++)
if (s[i]==' ') res[i]='_';
else res[i]=s[i];
mbk_res=namealloc(res);
mbkfree(res);
return mbk_res;
}
/*****************************************************************************/
/*remplace tous les espaces d'un mot par des '_' ----> pour mbkfree() */
char *del_espace_mbk(char *s)
{
char *res;
int i=0;
/*tests chaines vides*/
if (s==NULL || *s=='\0') return dupchaine(s);
res=(char*) mbkalloc(strlen(s)+1);
if (res==NULL) {fprintf(stderr,"Not enough memory!");exit(1);}
for (i=0;i<=strlen(s);i++)
if (s[i]==' ') res[i]='_';
else res[i]=s[i];
return (res);
}
/*****************************************************************************/
/*concatene deux chaines en allouant un nouvel espace memoire dans l'environnement mbk -----> impossible a deallouer*/
char *concat(char *s1,char *s2)
{
char *res,*mbk_res;
/*tests chaines vides*/
if (s2==NULL && s1==NULL) return NULL;
if (s1==NULL || *s1=='\0') return namealloc(s2);
if (s2==NULL || *s2=='\0') return namealloc(s1);
res=(char*)mbkalloc(strlen(s1)+strlen(s2)+1);
/*ne pas oublier le caractere de fin de chaine*/
res=strcpy(res,s1);
res=strcat(res,s2);
mbk_res=namealloc(res);
mbkfree(res);
return mbk_res;
}
/*****************************************************************************/
/*concatene deux chaines en allouant un nouvel espace memoire pour ensuite etre liberer par mbkfree() */
char *concat_mbk(char *s1,char *s2)
{
char *res;
/*tests chaines vides*/
if (s2==NULL && s1==NULL) return NULL;
if (s1==NULL || *s1=='\0') return dupchaine(s2);
if (s2==NULL || *s2=='\0') return dupchaine(s1);
res=(char*)mbkalloc(strlen(s1)+strlen(s2)+1);
/*ne pas oublier le caractere de fin de chaine*/
res=strcpy(res,s1);
res=strcat(res,s2);
return res;
}
/*****************************************************************************/
/* convertit un integer en string -------> impossible a desallouer*/
char *itoa(int nbr)
{
char tab[15]; /*espace suffisant pour un int sur 32 bits*/
sprintf(tab,"%d",nbr);
return namealloc(tab);
}
/*****************************************************************************/
/* convertit un integer en string pour mbkfree()*/
char *itoa_mbk(int nbr)
{
char tab[15]; /*espace suffisant pour un int sur 32 bits*/
sprintf(tab,"%d",nbr);
return dupchaine(tab);
}
/*****************************************************************************/
/* convertit un caractere en string -----> impossible a desallouer*/
char *ctoa(char c)
{
char tab[2];
tab[0]=c;
tab[1]='\0';
return namealloc(tab);
}
/*****************************************************************************/
/* convertit un caractere en string -----> pour mbkfree() */
char *ctoa_mbk(char c)
{
char tab[2];
tab[0]=c;
tab[1]='\0';
return dupchaine(tab);
}
/*****************************************************************************/
/* Conversion int en ASCII-binaire ----> impossible a desallouer*/
char * itoabin(valeur)
int valeur;
{
int i;
char abin[33];
abin[32] = '\0';
for(i = 0; i < 32; i++)
abin[31 - i] = (((valeur >> i) & 1) + '0');
return namealloc(abin);
}
/*****************************************************************************/
/* Conversion int en ASCII-binaire ----> pour mbkfree() */
char * itoabin_mbk(valeur)
int valeur;
{
int i;
char abin[33];
abin[32] = '\0';
for(i = 0; i < 32; i++)
abin[31 - i] = (((valeur >> i) & 1) + '0');
return dupchaine(abin);
}
/*****************************************************************************/
/* Conversion Ascii-binaire en int */
int abintoi(abin )
char *abin;
{
int valeur = 0;
char *yp;
for(yp = abin; *yp; yp++) {
valeur <<= 1;
valeur += *yp - '0';
}
return valeur;
}
/*****************************************************************************/
/*detruit tout une sequence de patterns*/
void erase_paseq(paseq_list *pat)
{
if (pat==NULL) return;
erase_paseq(pat->NEXT);
/*les patterns*/
if (pat->OLDPAT!=NULL) pat_frepapat(pat->OLDPAT);
else if (pat->CURPAT!=NULL) pat_frepapat(pat->CURPAT);
/*les commentaires*/
if (pat->DECCOM!=NULL) pat_frepacom(pat->DECCOM);
/*les array*/
if (pat->PAGRP!=NULL) pat_frepacom(pat->PAGRP);
/*les declarations in/out*/
/*if (pat->PAIOL!=NULL) pat_frepacom(pat->PAIOL);
on ne detruit pas les paiol(declarations in/out) par faute de core dump sans doute a cause des noms des paiol qui sont reserves par namealloc() */
/*detruire la structure header*/
mbkfree(pat);
}
/*****************************************************************************/
/* compte le nombre de pattern d'un fichier PAT et retourne...
-1 ---> erreur de chargement du fichier pattern
=>0 ---> nombre de patterns*/
int compte_pat(char *pat)
{
int i=0;
char c;
FILE *pat_in;
int not_com=2; /*il faut 2 tirets*/
pat=concat_mbk(pat,".pat");
pat_in=fopen(pat,"r");
if (ferror(pat_in)!=0) {
fprintf(stderr,"Unable to load %s\n",pat);
return -1;
}
/*compter le nbr de patterns c'est compter le nombre de ':' */
while ((c=fgetc(pat_in))!=EOF) {
if (c=='-') not_com--;
else if (not_com==1) not_com=2;
if (c=='\n') not_com=2;
if (c==':' && not_com) i++;
}
fclose(pat_in);
mbkfree(pat);
return i;
}
/*****************************************************************************/
/*recoit en parametre un temps en millseconds et l'affiche avec un format */
void affiche_time(unsigned long ms)
{
if (ms<=1) /*ordre de la millisecondes*/
{fprintf(stdout,"one millisecond");ms=1;}
else if (ms<1000) /*ordre de la millisecondes*/
fprintf(stdout,"%ld milliseconds",ms);
else if (ms<2000) /*ordre de la seconde*/
fprintf(stdout,"1.%03ld second",ms%1000);
else if (ms<60000) /*ordre de + secondes*/
fprintf(stdout,"%ld.%03ld seconds",ms/1000,ms%1000);
else if (ms<120000) /*ordre de la minute*/
fprintf(stdout,"1 minute %02ld",(ms/1000)%60);
else if (ms<3600000) /*ordre de + minutes*/
fprintf(stdout,"%ld minutes %02ld",ms/60000,(ms/1000)%60);
else if (ms<7200000) /*ordre de l'heure*/
fprintf(stdout,"1 hour %02ld",(ms/60000)%60);
else /*ordre de + heures*/
fprintf(stdout,"%ld hours %02ld",ms/3600000,(ms/60000)%60);
fflush(stdout);
}
/****************************************************************************/
/* Visualisation de la structure de donnees */
int AffichePaseq(pat)
struct paseq *pat;
{
struct paiol *ppaiol;
struct papat *ppapat;
struct paevt *ppaevt;
int i = 1;
fprintf(stdout,"Paseq -> Paiol :\n");
for(ppaiol = pat -> PAIOL; ppaiol; ppaiol = ppaiol -> NEXT) {
fprintf(stdout,"\tPaiol -> name : %s\n", (char*)ppaiol -> NAME);
fprintf(stdout,"\tPaiol -> formmat : %c\n", ppaiol -> FORMAT);
fprintf(stdout,"\tPaiol -> mode : %c\n\n", ppaiol -> MODE);
getchar();
}
fprintf(stdout,"Paseq -> iolnbr : %d\n", pat -> IOLNBR);
fprintf(stdout,"Paseq -> Papat :\n");
for(ppapat = pat -> CURPAT; ppapat; ppapat = ppapat -> NEXT) {
fprintf(stdout,"\tNumero : %d\n", i++);
fprintf(stdout,"\tPapat -> label : %s\n", (char*)ppapat -> LABEL);
fprintf(stdout,"\tPapat -> simflag : %c\n", ppapat -> SIMFLAG);
fprintf(stdout,"\tPapat -> Paevt\n");
getchar();
for(ppaevt = ppapat -> PAEVT; ppaevt; ppaevt = ppaevt -> NEXT) {
fprintf(stdout,"\t\tPaevt -> index : %d\n", ppaevt -> INDEX);
fprintf(stdout,"\t\tPaevt -> usrval : %c\n", ppaevt -> USRVAL);
fprintf(stdout,"\t\tPaevt -> simval : %c\n\n", ppaevt -> SIMVAL);
}
getchar();
fprintf(stdout,"\n");
}
fprintf(stdout,"Paseq -> errflg : %d\n", pat -> ERRFLG);
return(1);
}
/****************************************************************************/
/****************************************************************************/
/* allocation memoire */
static chain_list *mem=NULL; /*zones memoire */
static char *fin_mem=0;
static char *p_mem=0;
static chain_list *courant=NULL;
static unsigned int zone_mem=128;
/****************************************************************************/
void init_mem(unsigned int p)
{
p_mem=NULL;
fin_mem=NULL;
courant=NULL;
mem=NULL;
zone_mem=p*128; /*longueur moyenne multiple de 4*/
}
/****************************************************************************/
char *mon_malloc(char *s)
{
int taille=0;
chain_list *sup=NULL;
if (s==NULL) return NULL;
taille=strlen(s)+1;
if (taille>LABEL_BS_SIZE+1) taille=LABEL_BS_SIZE+1;
if (p_mem+taille>fin_mem) {
p_mem=(char*) mbkalloc(zone_mem);
fin_mem=p_mem+zone_mem;
sup=(chain_list*) mbkalloc(sizeof(chain_list));
sup->NEXT=NULL;
sup->DATA=(char*) p_mem;
if (mem==NULL) mem=sup;
else courant->NEXT=sup;
courant=sup;
}
if (p_mem+taille>fin_mem) { /*si encore depassement alors...*/
fprintf(stderr,"Out of Memory!!!\n");
exit(1);
}
s=strncpy(p_mem,s,taille); /*taille=30 caractères+ fin de string*/
p_mem+=taille;
return s;
}
/****************************************************************************/
void erase_chain(chain_list *l)
{
if (l==NULL) return;
erase_chain(l->NEXT);
mbkfree(l->DATA);
mbkfree(l);
l=NULL;
}
void mon_free()
{
p_mem=NULL;
fin_mem=NULL;
courant=NULL;
if (mem==NULL) return;
erase_chain (mem);
mem=NULL;
}
/*****************************************************************************/
/******************************* END OF FILE *********************************/
/*****************************************************************************/

View File

@ -0,0 +1,66 @@
/****************************************************************************/
/* Calcul un nombre entier eleve a une puissance entiere */
int pow();
/* Duplication de chaine de caracteres */
char *dupchaine();
/*concatene deux chaines en allouant un nouvel espace memoire dans l'environnement mbk de la facon suivante: s1 + ' ' + s2 ---> ne peut etre desallouer*/
char *concat_espace(char *s1,char *s2);
/*remplace tous les espaces d'un mot par des '_' ---> ne peut etre desallouer*/
char *del_espace(char *s);
/*remplace tous les espaces d'un mot par des '_' ---> pour mbkfree() */
char *del_espace_mbk(char *s);
/*concatene deux chaines en allouant un nouvel espace memoire dans l'environnement mbk---> ne peut etre desallouer*/
char *concat(char *s1,char *s2);
/*concatene deux chaines en allouant un nouvel espace memoire dans l'environnement mbk---> ne peut etre desallouer---> peut etre desallouer avec mbkfree*/
char *concat_mbk(char *s1,char *s2);
/* convertit un integer en string --->ne peut etre desallouer*/
char *itoa(int nbr);
/* convertit un integer en string--->peut etre desallouer a l'aide de mbkfree*/
char *itoa_mbk(int nbr);
/* convertit un caratere en string --->ne peut etre desallouer */
char *ctoa(char c);
/* convertit un caratere en string --->pour mbkfree() */
char *ctoa_mbk(char c);
/* Conversion int en ASCII-binaire ---> ne peut etre desallouer*/
char * itoabin(int valeur);
/* Conversion int en ASCII-binaire ---> pour mbkfree() */
char * itoabin_mbk(int valeur);
/* Conversion Ascii-binaire en int */
int abintoi(char *abin );
/*detruit tout une sequence de patterns*/
void erase_paseq(paseq_list *pat);
/* compte le nombre de pattern d'un fichier PAT et retourne...
-1 ---> erreur de chargement du fichier pattern
=>0 ---> nombre de patterns*/
int compte_pat(char *pat);
/*recoit en parametre un temps en millseconds et l'affiche avec un format*/
void affiche_time(unsigned long ms);
/* Visualisation de la structure de donnees */
int AffichePaseq(struct paseq *pat);
/*allocation memoire*/
/*p:sequence de patterns*/
void init_mem(unsigned int p);
char *mon_malloc(char *s);
void mon_free();
/*****************************************************************************/

View File

@ -0,0 +1,445 @@
/*####==============================================================####*/
/*## ##*/
/*## This file is part of BOUNDARY SCAN TESTER for PC/Linux Systems ##*/
/*## (C) 1995, 1996 MASI, CAO-VLSI Team ##*/
/*## ##*/
/*## Authors : Philippe OLEK, Olivier SIROL (1995) ##*/
/*## Authors : Eric MECHIN (1996) ##*/
/*## Authors : Francois DONNET (1998) ##*/
/*## ##*/
/*## E-mail support: cao-vlsi@masi.ibp.fr ##*/
/*## ##*/
/*####==============================================================####*/
/****************************************************************************/
#include "global.h"
/****************************************************************************/
/* Coherence entre longueurs des instructions et longueur du RI */
static int LgI_NbBit(Infos *inf)
{
Instructions *PInst;
Codes *PCode;
for(PInst = inf->inst; PInst; PInst = PInst -> suivant)
for(PCode = PInst -> code; PCode; PCode = PCode -> suivant) {
if(strlen(PCode->valeur) > inf->lg_inst) {fprintf(stderr,"[BS ERROR] : the instruction length is taller than the size of instruction register!\n");return(0);}
if(strlen(PCode->valeur) < inf->lg_inst) {fprintf(stderr,"[BS ERROR] : the size of instruction register is bigger than the instruction length!\n");return(0);}
}
return(1);
}
/****************************************************************************/
/* Coherence entre le nombre d'instructions et la longueur du registre
instruction */
static int LgI_NbI(Infos *inf)
{
Instructions *PInst;
Codes *PCode;
int i = 0, NbInst = 0;
for(PInst = inf->inst; PInst; PInst = PInst -> suivant)
for(PCode = PInst -> code; PCode; PCode = PCode -> suivant)
i++;
NbInst = pow(2, inf->lg_inst);
if(NbInst < i) {
fprintf(stderr,"[BS ERROR] : there are more instruction codes than authorized by instruction register!\n");
return(0);
}
else {
return(1);
}
}
/****************************************************************************/
/* Verification de la presence de l'instruction inst dans la structure
de donnees informations
norme speciale pour le bypass="1...1" et le extest="0...0"*/
static int PresenceI(Infos *inf, char *inst)
{
Instructions *pinst;
Codes *pcode;
char *code;
int i = 0;
for(pinst=inf->inst; pinst && strcmp(pinst->nom,inst); pinst=pinst->suivant);
if(pinst == NULL) {
fprintf(stderr,"[BS ERROR] %s : instruction is unknown!\n", (char*)inst);
return(0);
}
if(!strcmp(inst, "extest")) {
code = (char*)mbkalloc(inf -> lg_inst + 1);
for(i = 0; i < inf -> lg_inst; i++)
code[i] = '0';
code[i] = '\0';
for(pcode = pinst -> code; pcode; pcode = pcode -> suivant)
if(!strcmp(pcode -> valeur, code)) {
free(code);
return(1);
}
free(code);
fprintf(stderr,"[BS ERROR] %s : instruction code doesn' match with instruction EXTEST!\n", (char*)code);
return(0);
}
if(!strcmp(inst, "bypass")) {
code = (char*)mbkalloc(inf -> lg_inst +1);
for(i = 0; i < inf -> lg_inst; i++)
code[i] = '1';
code[i] = '\0';
for(pcode = pinst -> code; pcode; pcode = pcode -> suivant)
if(!strcmp(pcode -> valeur, code)) {
free(code);
return(1);
}
free(code);
fprintf(stderr,"[BS ERROR] %s : instruction code doesn' match with instruction BYPASS!\n", (char*)code);
return(0);
}
return(1);
}
/****************************************************************************/
/* Verification si des instructions ont ete dupliquees au niveau des codes */
static int EgaliteI(Infos *inf)
{
Instructions *P1Inst, *P2Inst;
Codes *P1Code,*P2Code;
for(P1Inst = inf->inst; P1Inst; P1Inst = P1Inst -> suivant)
for(P1Code = P1Inst -> code; P1Code; P1Code = P1Code -> suivant){
for(P2Code=P1Code->suivant; P2Code; P2Code=P2Code->suivant)
if(P1Code->valeur == P2Code->valeur) {fprintf(stderr,"[BS ERROR] %s : duplcated code!\n", P1Code->valeur);return(0);}
for(P2Inst = P1Inst->suivant; P2Inst; P2Inst = P2Inst -> suivant)
for(P2Code = P2Inst -> code; P2Code; P2Code = P2Code -> suivant)
if(P1Code->valeur == P2Code->valeur) {fprintf(stderr,"[BS ERROR] %s : duplcated code!\n", P1Code->valeur);return(0);}
}
return(1);
}
/****************************************************************************/
/* Coherence entre la longueur du registre Boundary Scan et le nombre de
cellules enumerees */
static int LgBS_NbCel(Infos *inf)
{
Cellules *PCel;
int i = 0;
for(PCel = inf->cel; PCel; PCel = PCel -> suivant)
i++;
if(inf->lg_bs > i) {
fprintf(stderr,"[BS ERROR] : tere are more BS cells than authorized!\n");
return(0);
}
else if(inf->lg_bs < i) {
fprintf(stderr,"[BS ERROR] : BS register is taller than the number of cells!\n");
return(0);
}
else {
return(1);
}
}
/****************************************************************************/
/* Verification si des cellules ont ete dupliquees au niveau du nom et du
mode */
static int EgaliteNomCel(Infos *inf)
{
Cellules *P1Cel, *P2Cel;
for(P1Cel = inf->cel; P1Cel; P1Cel = P1Cel -> suivant) {
if(P1Cel->nom!=NULL && strcmp(P1Cel -> nom, "*"))
for(P2Cel = P1Cel -> suivant; P2Cel; P2Cel = P2Cel -> suivant){
if(P2Cel->nom!=NULL && !strcmp(P2Cel -> nom, P1Cel -> nom) &&
P1Cel -> donnees[DMODE] == P2Cel -> donnees[DMODE]) {
fprintf(stderr,"[BS ERROR] %s : duplicate cell!\n", P1Cel -> nom);
return(0);
}
}
}
return(1);
}
/****************************************************************************/
/* Les cellules de mode control commandent-elles bien les bonnes cellules ? */
static int CelControl(Infos *inf)
{
Cellules *P1Cel, *P2Cel;
int i = 0;
for(P1Cel = inf->cel; P1Cel; P1Cel = P1Cel -> suivant)
if(P1Cel -> donnees[DCONTROLE] != -1)
for(P2Cel = inf->cel; P2Cel; P2Cel = P2Cel -> suivant)
if(P1Cel -> donnees[DCONTROLE] == i++)
if(P2Cel -> donnees[DMODE] != CONTROL) {
fprintf(stderr,"[BS ERROR] : the cell named %s is controled by a cell %s wich isn't CONTROL!\n", P1Cel -> nom, P2Cel -> nom);
return(0);
}
return(1);
}
/****************************************************************************/
/* Coherence entre le nombre d'entrees/sorties dans la structure des vecteurs
paralleles et la longueur du registre Boundary Scan de la structure
informations */
static int Iolnbr_LgBS(struct paseq *pat)
{
struct paiol *ppaiol;
Cellules *cel;
Infos *inf;
int nb_io = 0, nb_cell_valid=0;
/* utilisons une propriete de namealloc() qui rend toujours le meme vecteur*/
char *tck=namealloc("tck");
char *trst=namealloc("trst");
char *tms=namealloc("tms");
char *tdi=namealloc("tdi");
char *tdo=namealloc("tdo");
/*pour toutes les entrees sorties sauf l'alim. qui ne passe par la chaine BS*/
for(ppaiol = pat -> PAIOL; ppaiol; ppaiol = ppaiol -> NEXT)
if (ppaiol->NAME!=tck && ppaiol->NAME!=trst && ppaiol->NAME!=tms &&
ppaiol->NAME!=tdi && ppaiol->NAME!=tdo &&
!isvdd(ppaiol->NAME) && !isvss(ppaiol->NAME) &&
(ppaiol->MODE=='I' || ppaiol->MODE=='O' || ppaiol->MODE=='T'))
nb_io++;
for (inf=InfosVbe;inf;inf=inf->next)
for(cel=inf->cel;cel;cel=cel->suivant)
if (cel->nom!=tck && cel->nom!=trst && cel->nom!=tms &&
cel->nom!=tdi && cel->nom!=tdo &&
!isvdd(cel->nom) && !isvss(cel->nom) &&
(cel->donnees[DMODE]==INPUT || cel->donnees[DMODE]==OUTPUT2 ||
cel->donnees[DMODE]==INOUTPUT))
nb_cell_valid++;
if(verbose_flag && nb_io > nb_cell_valid) {
fprintf(stderr,"[PAT WARNING] : more data vector(%d) in PAT than in BS chain(%d)\n",nb_io,nb_cell_valid);
}
if(verbose_flag && nb_io < nb_cell_valid) {
fprintf(stderr,"[PAT WARNING] : not enough data vector(%d) in PAT for BS chain(%d)\n",nb_io,nb_cell_valid);
}
return(1);
}
/****************************************************************************/
/* Presence du nom et mode des entrees/sorties de la structure des vecteurs
paralleles dans la structure informations */
static int NamePaiol(struct paseq *pat)
{
struct paiol *ppaiol;
Cellules *pvbe,*c;
Infos *inf,*i;
int mode;
/* utilisons une propriete de namealloc() qui rend toujours le meme vecteur*/
char *tck=namealloc("tck");
char *trst=namealloc("trst");
char *tms=namealloc("tms");
char *tdi=namealloc("tdi");
char *tdo=namealloc("tdo");
ht *hsh_nom=addht(200);
/*pour toutes les entrees sorties sauf l'alim. qui ne passe par la chaine BS*/
for(ppaiol = pat -> PAIOL; ppaiol; ppaiol = ppaiol -> NEXT) {
if (ppaiol->NAME!=tck && ppaiol->NAME!=trst && ppaiol->NAME!=tms &&
ppaiol->NAME!=tdi && ppaiol->NAME!=tdo &&
!isvdd(ppaiol -> NAME) && !isvss(ppaiol -> NAME) &&
(ppaiol->MODE == 'I' || ppaiol->MODE == 'O' || ppaiol->MODE == 'T'))
{
/*recherche du connecteur dans la chaine boundary scan*/
for(inf=InfosVbe; inf; inf=inf->next) {
for(pvbe = inf -> cel; pvbe; pvbe = pvbe -> suivant)
if((pvbe->donnees[DMODE]==INPUT ||
pvbe->donnees[DMODE]==OUTPUT2 ||
pvbe->donnees[DMODE]==OUTPUT3 ||
pvbe->donnees[DMODE]==INOUTPUT) && pvbe->nom!=NULL &&
ppaiol->NAME!=NULL && pvbe->nom==ppaiol->NAME) break;
if (pvbe!=NULL) break;
}
if(pvbe == NULL) {
fprintf(stderr,
"[PAT ERROR] : connector named '%s' in PAT isn't declared as a BS cell!\n",
ppaiol -> NAME);
return(0);
}
mode=gethtitem(hsh_nom,pvbe->nom);
switch (pvbe->donnees[DMODE]) {
case INPUT:
if (ppaiol->MODE=='T' && mode!=OUTPUT3) {
for (c=pvbe->suivant;c;c=c->suivant)
if (c->nom==ppaiol->NAME) break;
if (c!=NULL && c->donnees[DMODE]==OUTPUT3) {
addhtitem(hsh_nom,pvbe->nom,OUTPUT2);
break;}
for(i=inf->next; i; i=i->next) {
for(c = i -> cel; c; c = c->suivant)
if (c->nom==ppaiol->NAME) break;
if (c!=NULL && c->donnees[DMODE]==OUTPUT3) break;}
if (c!=NULL && c->donnees[DMODE]==OUTPUT3) {
addhtitem(hsh_nom,pvbe->nom,OUTPUT2);
break;}
fprintf(stderr,
"[PAT ERROR] : 'in %s' is defined as 'inout %s' in PAT!\n"
,pvbe->nom,pvbe->nom);
return(0);}
else if (ppaiol->MODE=='O') {
fprintf(stderr,
"[PAT ERROR] : 'in %s' is defined as 'out %s' in PAT!\n"
,pvbe->nom,pvbe->nom);
return(0);}
else if (ppaiol->MODE!='I' && ppaiol->MODE!='T') {
fprintf(stderr,
"[PAT ERROR] : 'in %s' has incompatible types in files!\n"
,pvbe->nom);
return(0);}
if (mode!=EMPTYHT) {
if (mode==OUTPUT3) {
addhtitem(hsh_nom,pvbe->nom,OUTPUT2);
break;}
fprintf(stderr,
"[PAT ERROR] : '%s' already used!\n",pvbe->nom);
return(0);}
addhtitem(hsh_nom,pvbe->nom,pvbe->donnees[DMODE]);
break;
case OUTPUT2:
if (ppaiol->MODE=='I') {
fprintf(stderr,
"[PAT ERROR] : 'out %s' is defined as 'in %s' in PAT!\n"
,pvbe->nom,pvbe->nom);
return(0);}
else if (ppaiol->MODE=='T') {
fprintf(stderr,
"[PAT ERROR] : 'out %s' is defined as 'inout %s' in PAT!\n"
,pvbe->nom,pvbe->nom);
return(0);}
else if (ppaiol->MODE!='O') {
fprintf(stderr,
"[PAT ERROR] : 'out %s' has incompatible types in files!\n"
,pvbe->nom);
return(0);}
if (mode!=EMPTYHT) {
fprintf(stderr,
"[PAT ERROR] : '%s' already used!\n",pvbe->nom);
return(0);}
addhtitem(hsh_nom,pvbe->nom,pvbe->donnees[DMODE]);
break;
case OUTPUT3:
if (verbose_flag && ppaiol->MODE=='I') {
fprintf(stderr,
"[PAT WARNING] : 'inout %s' is defined as 'in %s' in PAT!\n"
,pvbe->nom,pvbe->nom);
}
else if (verbose_flag && ppaiol->MODE=='O') {
fprintf(stderr,
"[PAT WARNING] : 'inout %s' is defined as 'out %s' in PAT!\n"
,pvbe->nom,pvbe->nom);
}
else if (ppaiol->MODE!='T'&& ppaiol->MODE!='I'&& ppaiol->MODE!='O'){
fprintf(stderr,
"[PAT ERROR] : 'inout %s' has incompatible types in files!\n"
,pvbe->nom);
return(0);}
if (mode!=EMPTYHT) {
if (mode==INPUT) {
addhtitem(hsh_nom,pvbe->nom,OUTPUT2);
break;}
fprintf(stderr,
"[PAT ERROR] : '%s' already used!\n",pvbe->nom);
return(0);}
addhtitem(hsh_nom,pvbe->nom,pvbe->donnees[DMODE]);
break;
case INOUTPUT:
if (verbose_flag && ppaiol->MODE=='I') {
fprintf(stderr,
"[PAT WARNING] : 'inout %s' is defined as 'in %s' in PAT!\n"
,pvbe->nom,pvbe->nom);
}
else if (verbose_flag && ppaiol->MODE=='O') {
fprintf(stderr,
"[PAT WARNING] : 'inout %s' is defined as 'out %s' in PAT!\n"
,pvbe->nom,pvbe->nom);
}
else if(ppaiol->MODE!='T'&& ppaiol->MODE!='I'&& ppaiol->MODE!='O') {
fprintf(stderr,
"[PAT ERROR] : 'inout %s' has incompatible types in files!\n"
,pvbe->nom);
return(0);}
if (mode!=EMPTYHT) {
fprintf(stderr,
"[PAT ERROR] : '%s' already used!\n",pvbe->nom);
return(0);}
addhtitem(hsh_nom,pvbe->nom,pvbe->donnees[DMODE]);
break;
}
}
}
/*recherche du cote de la description*/
for(inf=InfosVbe; inf; inf=inf->next) {
for(pvbe = inf -> cel; pvbe; pvbe = pvbe -> suivant)
if ((pvbe->donnees[DMODE]==INPUT || pvbe->donnees[DMODE]==OUTPUT2
|| pvbe->donnees[DMODE]==OUTPUT3 ||
pvbe->donnees[DMODE]==INOUTPUT) && pvbe->nom!=NULL &&
!isvdd(pvbe->nom) && !isvss(pvbe->nom) &&
gethtitem(hsh_nom,pvbe->nom)==EMPTYHT) {
fprintf(stderr,"BS cell connector named '%s' isn't declared in PAT!\n",pvbe->nom);
return 0;
}
}
delht(hsh_nom);
return(1);
}
/****************************************************************************/
/* Coherences dans la structure informations */
int VerificationsInfos()
{
Infos *inf;
/*pour tous les ensembles boundary scan chaines*/
for (inf=InfosVbe;inf;inf=inf->next) {
/* Coherence entre le nombre d'instructions et la longueur du registre
instruction */
if(!LgI_NbI(inf)) return(1);
/* Coherence entre longueurs des instructions et longueur du RI */
if(!LgI_NbBit(inf)) return(1);
/*dans tout circuit boundary scan il existe intest="?...?" */
if(!PresenceI(inf,"intest")) return(1);
/*dans tout circuit boundary scan il existe bypass="1...1" */
if(!PresenceI(inf,"bypass")) return(1);
/*dans tout circuit boundary scan sauf EMULBS il existe extest="0...0" */
if(!emulbs_flag && !PresenceI(inf,"extest")) return(1);
/* Verification si des instructions ont ete dupliquees au niveau des codes */
if(!EgaliteI(inf)) return(1);
/* Coherence entre la longueur du registre Boundary Scan et le nombre de
cellules enumerees */
if(!LgBS_NbCel(inf)) return(1);
/* Verification si des cellules ont ete dupliquees au niveau du nom et du
mode */
if(!EgaliteNomCel(inf)) return(1);
/* Les cellules de mode control commandent-elles bien les bonnes cellules ? */
if(!CelControl(inf)) return(1);
}
return(0);
}
/****************************************************************************/
/* Coherences entre structures : des vecteurs paralleles et informations */
int VerificationsPat(struct paseq *pat)
{
/* Presence du nom et mode des entrees/sorties de la structure des vecteurs
paralleles dans la structure informations */
if(!NamePaiol(pat)) return(1);
/* Coherence entre le nombre d'entrees/sorties dans la structure des vecteurs
paralleles et la longueur du registre Boundary Scan de la structure
informations */
if(!Iolnbr_LgBS(pat)) return(1);
return(0);
}
/****************************************************************************/

View File

@ -0,0 +1,9 @@
/****************************************************************************/
/* Controle des informations a l'interieur de la structure de donnees
informations */
int VerificationsInfos();
/* Controle des informations entre les structures de donnees informations et
vecteurs paralleles */
int VerificationsPat(struct paseq *pat);
/****************************************************************************/