From 7b122e1c004d4554f2d117683e592415a88e3dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Sat, 2 Feb 2008 18:17:43 +0000 Subject: [PATCH] Updates required to parse some Xilins BSDL files: - bsdl file for 2001 standard added - MAXLEN_DATA_REGISTER increased to 32 - convert bsdl package filename to uppercase git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@988 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 5 + jtag/data/bsdl/STD_1149_1_2001 | 259 +++++++++++++++++++++++++++++++++ jtag/include/data_register.h | 2 +- jtag/src/bsdl/bsdl.h | 2 +- jtag/src/bsdl/bsdl_flex.l | 11 +- jtag/src/bsdl/bsdl_sem.c | 3 + jtag/src/cmd/print.c | 20 +-- 7 files changed, 289 insertions(+), 13 deletions(-) create mode 100644 jtag/data/bsdl/STD_1149_1_2001 diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 3d4bbac8..4f4b2605 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,5 +1,10 @@ 2008-02-02 Arnim Laeuger + * src/bsdl/bsdl.h, src/bsdl/bsdl_flex.l: convert filename to uppercase + * src/bsdl/bsdl_sem.c (create_register): don't create a new register if it's already there + * data/bsdl/STD_1149_1_2001: dummy file for 2001 standard added + * src/cmd/print.c (cmd_print_run): accept longer data register name + * include/data_register.h (MAXLEN_DATA_REGISTER): increased to 32 for some BSDL files * src/flash/amd.c (amdstatus): increase timeout count to address [ 1882111 ] Timeout in amdstatus() too small diff --git a/jtag/data/bsdl/STD_1149_1_2001 b/jtag/data/bsdl/STD_1149_1_2001 new file mode 100644 index 00000000..a0e1c3e0 --- /dev/null +++ b/jtag/data/bsdl/STD_1149_1_2001 @@ -0,0 +1,259 @@ +-- +-- $Id$ +-- +-- Email header accompanying the original Yacc code: +-- http://www.eda.org/vug_bbs/bsdl.parser +-- +-- -----------------------------------8<-------------------------------------- +-- +-- Hello All, +-- +-- This is this first mailing of the BSDL* Version 0.0 parser specifications +-- we are sending to people who request it from our publicized E-Mail address; +-- +-- bsdl%hpmtlx@hplabs.HP.com +-- +-- You are free to redistribute this at will, but we feel that it would be +-- better if respondents asked for it directly so that their addresses can +-- be entered into our list for future mailings and updates. +-- +-- It would be helpful if you could confirm receipt of this transmission. +-- We also would be very interested to hear about your experiences with this +-- information and what you are planning to do with BSDL. +-- +-- Regards, +-- +-- Ken Parker +-- Hewlett-Packard Company +-- +-- +-- *Boundary-Scan Description Language - as documented in: +-- +-- "A Language for Describing Boundary-Scan Devices", K.P. Parker +-- and S. Oresjo, Proceedings 1990 International Test Conference, +-- Washington DC, pp 222-234 +-- +-- +-- - -----------------cut here--------------------------------------------------- +-- +-- +-- 901004.0721 Hewlett-Packard Company +-- 901016.1049 Manufacturing Test Division +-- P.O. Box 301 +-- Loveland, Colorado 80537 +-- USA +-- +-- October 1990 +-- Hello BSDL Parser Requestor, +-- +-- This Electronic Mail reply contains the computer specifications for +-- Hewlett-Packard's Version 0.0 BSDL parser. This section of the reply +-- explains the contents of the rest of this file. +-- +-- This file is composed of seven (7) parts: +-- +-- 1) How to use this file +-- +-- 2) UNIX* Lex source (lexicographical tokenizing rules) +-- +-- 3) UNIX* Yacc source (BNF-like syntax description) +-- +-- 4) A sample main program to recognize BSDL. +-- +-- 5) A BSDL description of the Texas Instruments 74bct8374 that is +-- recognized by the parser, for testing purposes. +-- +-- 6) The VHDL package STD_1149_1_1990 needed by this parser. +-- +-- 7) [added 901016] Porting experiences to other systems. +-- +-- +-- RECOMMENDATION: Save a copy of this file in archival storage before +-- processing it via the instructions below. This will +-- allow you to recover from errors, and allow you to +-- compare subsequently released data for changes. +-- +-- DISCLAIMERS: +-- +-- 1. The IEEE 1149.1 Working Group has not endorsed BSDL Version 0.0 and +-- therefore no person may represent it as an IEEE standard or imply that +-- a resulting IEEE standard will be identical to it. +-- +-- 2. The IEEE 1149.1 Working Group recognizes that BSDL Version 0.0 is a +-- well-conceived initiative that is likely to excelerate the creation +-- of tools that support the 1149.1 standard. As such, changes and +-- enhancements will be carefully considered so as not to needlessly +-- disrupt these development efforts. The overriding goal is the +-- ultimate success of the 1149.1 standard. +-- +-- LEGAL NOTICES: +-- +-- Hewlett-Packard Company makes no warranty of any kind with regard to +-- this information, including, but not limited to, the implied +-- waranties of merchantability and fitness for a particular purpose. +-- +-- Hewlett-Packard Company shall not be liable for errors contained +-- herein or direct, indirect, special, incidental, or consequential +-- damages in connection with the furnishing, performance, or use of +-- this material. +-- +-- +-- *UNIX is a trademark of AT&T in the USA and other countries. +-- + +-- STD_1149_1_1990 VHDL Package and Package Body in support of +-- BSDL Version 0.0 +-- + +-- package STD_1149_1_1990 is -- Created 900525 + package STD_1149_1_2001 is + + -- Give pin mapping declarations + + attribute PIN_MAP : string; + subtype PIN_MAP_STRING is string; + + -- Give TAP control declarations + + type CLOCK_LEVEL is (LOW, BOTH); + type CLOCK_INFO is record + FREQ : real; + LEVEL: CLOCK_LEVEL; + end record; + + attribute TAP_SCAN_IN : boolean; + attribute TAP_SCAN_OUT : boolean; + attribute TAP_SCAN_CLOCK: CLOCK_INFO; + attribute TAP_SCAN_MODE : boolean; + attribute TAP_SCAN_RESET: boolean; + + -- Give instruction register declarations + + attribute INSTRUCTION_LENGTH : integer; + attribute INSTRUCTION_OPCODE : string; + attribute INSTRUCTION_CAPTURE : string; + attribute INSTRUCTION_DISABLE : string; + attribute INSTRUCTION_GUARD : string; + attribute INSTRUCTION_PRIVATE : string; + attribute INSTRUCTION_USAGE : string; + attribute INSTRUCTION_SEQUENCE : string; + + -- Give ID and USER code declarations + + type ID_BITS is ('0', '1', 'x', 'X'); + type ID_STRING is array (31 downto 0) of ID_BITS; + attribute IDCODE_REGISTER : ID_STRING; + attribute USERCODE_REGISTER: ID_STRING; + + -- Give register declarations + + attribute REGISTER_ACCESS : string; + + -- Give boundary cell declarations + + type BSCAN_INST is (EXTEST, SAMPLE, INTEST, RUNBIST); + type CELL_TYPE is (INPUT, INTERNAL, CLOCK, + CONTROL, CONTROLR, OUTPUT2, + OUTPUT3, BIDIR_IN, BIDIR_OUT); + type CAP_DATA is (PI, PO, UPD, CAP, X, ZERO, ONE); + type CELL_DATA is record + CT : CELL_TYPE; + I : BSCAN_INST; + CD : CAP_DATA; + end record; + type CELL_INFO is array (positive range <>) of CELL_DATA; + + -- Boundary Cell defered constants (see package body) + + constant BC_1 : CELL_INFO; + constant BC_2 : CELL_INFO; + constant BC_3 : CELL_INFO; + constant BC_4 : CELL_INFO; + constant BC_5 : CELL_INFO; + constant BC_6 : CELL_INFO; + + -- Boundary Register declarations + + attribute BOUNDARY_CELLS : string; + attribute BOUNDARY_LENGTH : integer; + attribute BOUNDARY_REGISTER : string; + + -- Miscellaneous + + attribute DESIGN_WARNING : string; +--end STD_1149_1_1990; -- End of 1149.1-1990 Package +end STD_1149_1_2001; + + +--package body STD_1149_1_1990 is -- Standard Boundary Cells + -- Written 900525 +package body STD_1149_1_2001 is + +-- Description for f10-12, f10-16, f10-18c, f10-18d, f10-21c + +constant BC_1 : CELL_INFO := + ((INPUT, EXTEST, PI), (OUTPUT2, EXTEST, PI), + (INPUT, SAMPLE, PI), (OUTPUT2, SAMPLE, PI), + (INPUT, INTEST, PI), (OUTPUT2, INTEST, PI), + (INPUT, RUNBIST, PI), (OUTPUT2, RUNBIST, PI), + (OUTPUT3, EXTEST, PI), (INTERNAL, EXTEST, PI), + (OUTPUT3, SAMPLE, PI), (INTERNAL, SAMPLE, PI), + (OUTPUT3, INTEST, PI), (INTERNAL, INTEST, PI), + (OUTPUT3, RUNBIST, PI), (INTERNAL, RUNBIST, PI), + (CONTROL, EXTEST, PI), (CONTROLR, EXTEST, PI), + (CONTROL, SAMPLE, PI), (CONTROLR, SAMPLE, PI), + (CONTROL, INTEST, PI), (CONTROLR, INTEST, PI), + (CONTROL, RUNBIST, PI), (CONTROLR, RUNBIST, PI) ); + +-- Description for f10-8, f10-17, f10-19c, f10-19d, f10-22c + +constant BC_2 : CELL_INFO := + ((INPUT, EXTEST, PI), (OUTPUT2, EXTEST, UPD), + (INPUT, SAMPLE, PI), (OUTPUT2, SAMPLE, PI), + (INPUT, INTEST, UPD), -- Intest on output2 not supported + (INPUT, RUNBIST, UPD), (OUTPUT2, RUNBIST, UPD), + (OUTPUT3, EXTEST, UPD), (INTERNAL, EXTEST, PI), + (OUTPUT3, SAMPLE, PI), (INTERNAL, SAMPLE, PI), + (OUTPUT3, INTEST, PI), (INTERNAL, INTEST, UPD), + (OUTPUT3, RUNBIST, PI), (INTERNAL, RUNBIST, UPD), + (CONTROL, EXTEST, UPD), (CONTROLR, EXTEST, UPD), + (CONTROL, SAMPLE, PI), (CONTROLR, SAMPLE, PI), + (CONTROL, INTEST, PI), (CONTROLR, INTEST, PI), + (CONTROL, RUNBIST, PI), (CONTROLR, RUNBIST, PI) ); + +-- Description for f10-9 + +constant BC_3 : CELL_INFO := + ((INPUT, EXTEST, PI), (INTERNAL, EXTEST, PI), + (INPUT, SAMPLE, PI), (INTERNAL, SAMPLE, PI), + (INPUT, INTEST, PI), (INTERNAL, INTEST, PI), + (INPUT, RUNBIST, PI), (INTERNAL, RUNBIST, PI) ); + +-- Description for f10-10, f10-11 + +constant BC_4 : CELL_INFO := + ((INPUT, EXTEST, PI), -- Intest on input not supported + (INPUT, SAMPLE, PI), -- Runbist on input not supported + (CLOCK, EXTEST, PI), (INTERNAL, EXTEST, PI), + (CLOCK, SAMPLE, PI), (INTERNAL, SAMPLE, PI), + (CLOCK, INTEST, PI), (INTERNAL, INTEST, PI), + (CLOCK, RUNBIST, PI), (INTERNAL, RUNBIST, PI) ); + +-- Description for f10-20c, a combined Input/Control + +constant BC_5 : CELL_INFO := + ((INPUT, EXTEST, PI), (CONTROL, EXTEST, PI), + (INPUT, SAMPLE, PI), (CONTROL, SAMPLE, PI), + (INPUT, INTEST, UPD), (CONTROL, INTEST, UPD), + (INPUT, RUNBIST, PI), (CONTROL, RUNBIST, PI) ); + +-- Description for f10-22d, a reversible cell + +constant BC_6 : CELL_INFO := + ((BIDIR_IN, EXTEST, PI), (BIDIR_OUT, EXTEST, UPD), + (BIDIR_IN, SAMPLE, PI), (BIDIR_OUT, SAMPLE, PI), + (BIDIR_IN, INTEST, UPD), (BIDIR_OUT, INTEST, PI), + (BIDIR_IN, RUNBIST, UPD), (BIDIR_OUT, RUNBIST, PI) ); + +--end STD_1149_1_1990; -- End of 1149.1-1990 Package Body +end STD_1149_1_2001; diff --git a/jtag/include/data_register.h b/jtag/include/data_register.h index 0e48fcc7..823a01f5 100644 --- a/jtag/include/data_register.h +++ b/jtag/include/data_register.h @@ -27,7 +27,7 @@ #include "register.h" -#define MAXLEN_DATA_REGISTER 10 +#define MAXLEN_DATA_REGISTER 32 typedef struct data_register data_register; diff --git a/jtag/src/bsdl/bsdl.h b/jtag/src/bsdl/bsdl.h index 0657560c..1ae5ee6e 100644 --- a/jtag/src/bsdl/bsdl.h +++ b/jtag/src/bsdl/bsdl.h @@ -139,7 +139,7 @@ void bsdl_msg(int, const char *, ...); /* BSDL lexer declarations */ void *bsdl_flex_init(FILE *); void bsdl_flex_deinit(void *); -void bsdl_flex_switch_file(void *, const char *); +void bsdl_flex_switch_file(void *, char *); void bsdl_flex_switch_buffer(void *, const char *); int bsdl_flex_get_compile_errors(void *); int bsdl_flex_postinc_compile_errors(void *); diff --git a/jtag/src/bsdl/bsdl_flex.l b/jtag/src/bsdl/bsdl_flex.l index f80d013e..7865d40f 100644 --- a/jtag/src/bsdl/bsdl_flex.l +++ b/jtag/src/bsdl/bsdl_flex.l @@ -475,10 +475,19 @@ static char *new_string(const char *str) } -void bsdl_flex_switch_file(yyscan_t scanner, const char *filename) +void bsdl_flex_switch_file(yyscan_t scanner, char *filename) { scan_extra_t *extra; FILE *f; + char *s; + + /* convert filename to all upper case */ + s = filename; + while (*s) { + if (islower(*s)) + *s = toupper(*s); + s++; + } /* file in current directory has precedence */ f = fopen(filename, "r"); diff --git a/jtag/src/bsdl/bsdl_sem.c b/jtag/src/bsdl/bsdl_sem.c index 6d4db736..1237fb8a 100644 --- a/jtag/src/bsdl/bsdl_sem.c +++ b/jtag/src/bsdl/bsdl_sem.c @@ -404,6 +404,9 @@ static void create_register(parser_priv_t *priv, char *reg_name, size_t len) len_str, NULL}; + if (part_find_data_register(priv->jtag_ctrl.part, reg_name)) + return; + /* convert length information to string */ snprintf(len_str, str_len, "%i", len); diff --git a/jtag/src/cmd/print.c b/jtag/src/cmd/print.c index a137264c..5ca2330e 100644 --- a/jtag/src/cmd/print.c +++ b/jtag/src/cmd/print.c @@ -37,12 +37,12 @@ static int cmd_print_run( char *params[] ) { - char format[100]; + char format[128]; #if HAVE_SWPRINTF - wchar_t wformat[100]; + wchar_t wformat[128]; #endif /* HAVE_SWPRINTF */ - wchar_t wheader[100]; - char header[100]; + wchar_t wheader[128]; + char header[128]; int i; int noheader = 0; @@ -84,17 +84,17 @@ cmd_print_run( char *params[] ) } if (noheader == 0) { - snprintf( format, 100, _(" No. %%-%ds %%-%ds %%-%ds %%-%ds %%-%ds\n"), MAXLEN_MANUFACTURER, MAXLEN_PART, MAXLEN_STEPPING, + snprintf( format, 128, _(" No. %%-%ds %%-%ds %%-%ds %%-%ds %%-%ds\n"), MAXLEN_MANUFACTURER, MAXLEN_PART, MAXLEN_STEPPING, MAXLEN_INSTRUCTION, MAXLEN_DATA_REGISTER ); #if HAVE_SWPRINTF - if (mbstowcs( wformat, format, 100 ) == -1) + if (mbstowcs( wformat, format, 128 ) == -1) printf( _("(%d) String conversion failed!\n"), __LINE__ ); - swprintf( wheader, 100, wformat, _("Manufacturer"), _("Part"), _("Stepping"), _("Instruction"), _("Register") ); - if (wcstombs( header, wheader, 100 ) == -1) + swprintf( wheader, 128, wformat, _("Manufacturer"), _("Part"), _("Stepping"), _("Instruction"), _("Register") ); + if (wcstombs( header, wheader, 128 ) == -1) printf( _("(%d) String conversion failed!\n"), __LINE__ ); #else /* HAVE_SWPRINTF */ - snprintf( header, 100, format, _("Manufacturer"), _("Part"), _("Stepping"), _("Instruction"), _("Register") ); - if (mbstowcs( wheader, header, 100 ) == -1) + snprintf( header, 128, format, _("Manufacturer"), _("Part"), _("Stepping"), _("Instruction"), _("Register") ); + if (mbstowcs( wheader, header, 128 ) == -1) printf( _("(%d) String conversion failed!\n"), __LINE__ ); #endif /* HAVE_SWPRINTF */ printf( header );