restructure: code+libs under src/, runtime resources under data/
Separate the two concerns the repo root was mixing:
- src/ — bs/, modules/, libs/ (code + vendored libs)
- data/ — fpga_registry.yaml, probes.yaml, bsdl_files/, bscan_proxies/,
scripts/ (everything the tool reads at runtime, CWD-relative)
- doc/ — kept at the root
CMake: repoint DIR_MODULES/DIR_LIBS and add_subdirectory at src/; emit
the binary at the build/ root (build/bs) via CMAKE_RUNTIME_OUTPUT_DIRECTORY
instead of the nested build/src/bs/. The jtag_core ../../libs path still
resolves since modules and libs moved together.
Runtime default paths now point under data/ (fpga.c, probes.c, script.c
bsdl_files lookup, init.c config.script). Docs (README/tutorial/CLAUDE)
updated for the new layout, src/ module paths, and ./build/bs.
Validated on the IGLOO2/FlashPro: profiles, autoinit, and svf_play all
work run from the repo root.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
7
src/modules/bsdl_parser/CMakeLists.txt
Normal file
7
src/modules/bsdl_parser/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
file(GLOB_RECURSE ALL_SOURCES "*.c")
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
|
||||
add_library(bsdl_parser ${ALL_SOURCES})
|
||||
1520
src/modules/bsdl_parser/bsdl_loader.c
Normal file
1520
src/modules/bsdl_parser/bsdl_loader.c
Normal file
File diff suppressed because it is too large
Load Diff
87
src/modules/bsdl_parser/bsdl_loader.h
Normal file
87
src/modules/bsdl_parser/bsdl_loader.h
Normal file
@@ -0,0 +1,87 @@
|
||||
#ifndef _BSDL_LOADER_H
|
||||
#define _BSDL_LOADER_H
|
||||
/*
|
||||
* JTAG Core library
|
||||
* Copyright (c) 2008 - 2024 Viveris Technologies
|
||||
*
|
||||
* JTAG Core library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* JTAG Core library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with JTAG Core library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file bsdl_loader.h
|
||||
* @brief bsdl file parser header
|
||||
* @author Jean-François DEL NERO <Jean-Francois.DELNERO@viveris.fr>
|
||||
*/
|
||||
|
||||
#include "jtag_core/jtag_core.h"
|
||||
|
||||
#define MAX_ELEMENT_SIZE (64+1)
|
||||
|
||||
typedef struct _pin_ctrl
|
||||
{
|
||||
char pinname[MAX_ELEMENT_SIZE];
|
||||
int pintype;
|
||||
|
||||
char physical_pin[MAX_ELEMENT_SIZE];
|
||||
|
||||
int ctrl_bit_number;
|
||||
int out_bit_number;
|
||||
int in_bit_number;
|
||||
}pin_ctrl;
|
||||
|
||||
typedef struct _jtag_chain
|
||||
{
|
||||
int bit_index;
|
||||
|
||||
int bit_cell_type; // BC_1,BC_2,...
|
||||
|
||||
char pinname[MAX_ELEMENT_SIZE]; // Pin name.
|
||||
|
||||
int bit_type; // None , ctrl , in, out.
|
||||
|
||||
int safe_state; // Default - Safe state. (0,1,-1)
|
||||
|
||||
int control_bit_index; // Indicate the associated control bit. -1 if no control bit.
|
||||
int control_disable_state;
|
||||
int control_disable_result;
|
||||
|
||||
}jtag_chain;
|
||||
|
||||
typedef struct _jtag_bsdl
|
||||
{
|
||||
unsigned long chip_id;
|
||||
unsigned long chip_id_mask;
|
||||
|
||||
char src_filename[512];
|
||||
char entity_name[512];
|
||||
|
||||
int number_of_chainbits;
|
||||
jtag_chain * chain_list;
|
||||
|
||||
int number_of_pins;
|
||||
pin_ctrl * pins_list;
|
||||
|
||||
int number_of_bits_per_instruction;
|
||||
char IDCODE_Instruction[MAX_ELEMENT_SIZE];
|
||||
char EXTEST_Instruction[MAX_ELEMENT_SIZE];
|
||||
char BYPASS_Instruction[MAX_ELEMENT_SIZE];
|
||||
char SAMPLE_Instruction[MAX_ELEMENT_SIZE];
|
||||
|
||||
}jtag_bsdl;
|
||||
|
||||
jtag_bsdl * load_bsdlfile(jtag_core * jc,char *filename);
|
||||
void unload_bsdlfile(jtag_core * jc, jtag_bsdl * bsdl);
|
||||
|
||||
#endif
|
||||
93
src/modules/bsdl_parser/bsdl_strings.c
Normal file
93
src/modules/bsdl_parser/bsdl_strings.c
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* JTAG Core library
|
||||
* Copyright (c) 2008 - 2024 Viveris Technologies
|
||||
*
|
||||
* JTAG Core library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* JTAG Core library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with JTAG Core library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file bsdl_strings.c
|
||||
* @brief bsdl file string keywords
|
||||
* @author Jean-François DEL NERO <Jean-Francois.DELNERO@viveris.fr>
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "jtag_core/jtag_core.h"
|
||||
|
||||
#include "bsdl_loader.h"
|
||||
#include "bsdl_strings.h"
|
||||
|
||||
type_strings celltype_str[]=
|
||||
{
|
||||
{"BC_1",CELLTYPE_BC1},
|
||||
{"BC_2",CELLTYPE_BC2},
|
||||
{"BC_3",CELLTYPE_BC3},
|
||||
{"BC_4",CELLTYPE_BC4},
|
||||
{"BC_5",CELLTYPE_BC5},
|
||||
{"BC_6",CELLTYPE_BC6},
|
||||
{"BC_7",CELLTYPE_BC7},
|
||||
|
||||
{0,CELLTYPE_UNKNOWN}
|
||||
};
|
||||
|
||||
type_strings bittype_str[]=
|
||||
{
|
||||
{"INPUT",BITTYPE_INPUT},
|
||||
{"OBSERVE_ONLY",BITTYPE_INPUT},
|
||||
{"OUTPUT",BITTYPE_OUTPUT},
|
||||
{"OUTPUT2", BITTYPE_OUTPUT },
|
||||
{"OUTPUT3",BITTYPE_TRISTATE_OUTPUT},
|
||||
{"BIDIR",BITTYPE_INOUT},
|
||||
{"CONTROL",BITTYPE_CONTROL},
|
||||
{"CONTROLR",BITTYPE_CONTROL},
|
||||
{"INTERNAL",BITTYPE_INTERNAL},
|
||||
{0,BITTYPE_UNKNOWN}
|
||||
};
|
||||
|
||||
type_strings statetype_str[]=
|
||||
{
|
||||
{"X",STATE_UNDEF},
|
||||
{"1",STATE_HIGH},
|
||||
{"0",STATE_LOW},
|
||||
{"Z",STATE_HIGHZ},
|
||||
{0,STATE_UNKNOWN}
|
||||
};
|
||||
|
||||
type_strings pintype_str[]=
|
||||
{
|
||||
{"IN",IO_IN},
|
||||
{"OUT",IO_OUT},
|
||||
{"INOUT",IO_INOUT},
|
||||
{"BUFFER", IO_OUT },
|
||||
{0,IO_UNDEF}
|
||||
};
|
||||
|
||||
int get_typecode(type_strings * typelist,char * name)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while( typelist[i].type_name )
|
||||
{
|
||||
if(!strcmp( typelist[i].type_name, name ) )
|
||||
{
|
||||
return typelist[i].type_code;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return typelist[i].type_code;
|
||||
}
|
||||
81
src/modules/bsdl_parser/bsdl_strings.h
Normal file
81
src/modules/bsdl_parser/bsdl_strings.h
Normal file
@@ -0,0 +1,81 @@
|
||||
#ifndef _BSDL_STRING_H
|
||||
#define _BSDL_STRING_H
|
||||
/*
|
||||
* JTAG Core library
|
||||
* Copyright (c) 2008 - 2024 Viveris Technologies
|
||||
*
|
||||
* JTAG Core library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* JTAG Core library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with JTAG Core library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file bsdl_strings.h
|
||||
* @brief bsdl file string keywords header
|
||||
* @author Jean-François DEL NERO <Jean-Francois.DELNERO@viveris.fr>
|
||||
*/
|
||||
|
||||
typedef struct type_strings_
|
||||
{
|
||||
char * type_name;
|
||||
int type_code;
|
||||
}type_strings;
|
||||
|
||||
enum CELLTYPE
|
||||
{
|
||||
CELLTYPE_UNKNOWN = 0x00,
|
||||
CELLTYPE_BC1,
|
||||
CELLTYPE_BC2,
|
||||
CELLTYPE_BC3,
|
||||
CELLTYPE_BC4,
|
||||
CELLTYPE_BC5,
|
||||
CELLTYPE_BC6,
|
||||
CELLTYPE_BC7
|
||||
};
|
||||
|
||||
enum BITTYPE
|
||||
{
|
||||
BITTYPE_UNKNOWN = 0x00,
|
||||
BITTYPE_INPUT,
|
||||
BITTYPE_OUTPUT,
|
||||
BITTYPE_TRISTATE_OUTPUT,
|
||||
BITTYPE_INOUT,
|
||||
BITTYPE_CONTROL,
|
||||
BITTYPE_INTERNAL
|
||||
};
|
||||
|
||||
enum STATETYPE
|
||||
{
|
||||
STATE_UNKNOWN = 0x00,
|
||||
STATE_UNDEF,
|
||||
STATE_HIGH,
|
||||
STATE_LOW,
|
||||
STATE_HIGHZ
|
||||
};
|
||||
|
||||
enum PINIOTYPE
|
||||
{
|
||||
IO_UNDEF = 0x00,
|
||||
IO_IN,
|
||||
IO_OUT,
|
||||
IO_INOUT
|
||||
};
|
||||
|
||||
extern type_strings celltype_str[];
|
||||
extern type_strings bittype_str[];
|
||||
extern type_strings statetype_str[];
|
||||
extern type_strings pintype_str[];
|
||||
|
||||
int get_typecode(type_strings * typelist,char * name);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user