Skip to content

Commit

Permalink
Merge pull request #33 from byuccl/dev
Browse files Browse the repository at this point in the history
Lots of changes
  • Loading branch information
JacksonSahleen committed Aug 24, 2022
2 parents c7fc0f4 + 09abe74 commit 7f8af08
Show file tree
Hide file tree
Showing 13 changed files with 355 additions and 92 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ BFAT utilizes the ProjectXray database in its design analysis and clones the dat
2. Install Vivado HDL Tools
> **Note:** We recommend Vivado version 2021.2 or later, as earlier versions are untested and we cannot guarantee that they will work
3. Install Python 3.8+, its cooresponding Virtual Environement (venv) module, and a valid Java JDK
3. Install Python 3.8+, its corresponding Virtual Environement (venv) module, and a valid Java JDK
```
sudo apt install python<dist> python<dist>-venv default-jdk
```
Expand Down Expand Up @@ -117,6 +117,7 @@ BFAT utilizes the ProjectXray database in its design analysis and clones the dat
## Supported Parts:

### Artix-7
- xc7a35t family
- xc7a50t family
- xc7a100t family
- xc7a200t family
Expand Down
29 changes: 22 additions & 7 deletions bfat.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,15 @@ def gen_tcl_cmds(fault_info:list, outfile:TextIOWrapper):
tile, _, _, _, _, fault_msg, aff_rsrcs, aff_pips = fault_info
tile_type = get_tile_type_name(tile)

outfile.write('\n\tVivado Tcl Commands:\n')

# Get the nets and pips from the fault bit's fault info and add them to
# the generated tcl command to select them in Vivado
if 'INT' in tile and ('Opens' in fault_msg or 'Shorts' in fault_msg):

# Print the tcl command for selecting the affected pips
reformatted_pips = [f'{tile}/{tile_type}.{pip.split(" ")[0]}' for pip in aff_pips]
outfile.write(f'\n\tselect_objects [get_pips {{{" ".join(reformatted_pips)}}}]')
outfile.write(f'\t\tselect_objects [get_pips {{{" ".join(sorted(reformatted_pips))}}}]\n')

msg_nets = []

Expand Down Expand Up @@ -149,13 +151,13 @@ def gen_tcl_cmds(fault_info:list, outfile:TextIOWrapper):
msg_nets_str = msg_nets_str.replace("GLOBAL_LOGIC0", "GND_2")
msg_nets_str = msg_nets_str.replace("GLOBAL_LOGIC1", "VCC_2")

outfile.write(f'\n\tselect_objects [get_nets {{{msg_nets_str}}}]')
outfile.write(f'\t\tselect_objects [get_nets {{{msg_nets_str}}}]\n')

# Get the cells of the affected resources if there are any and add them
# to the generated tcl command to select them in Vivado
if aff_rsrcs and 'NA' not in aff_rsrcs and 'No affected resources found' not in aff_rsrcs:
aff_rsrcs_str = ' '.join(sorted(aff_rsrcs))
outfile.write(f'\n\tselect_objects [get_cells {{{aff_rsrcs_str}}}]\n')
outfile.write(f'\t\tselect_objects [get_cells {{{aff_rsrcs_str}}}]\n')
elif 'INT' in tile and ('Opens' in fault_msg or 'Shorts' in fault_msg):
outfile.write('\n')
outfile.write('\n')
Expand All @@ -169,18 +171,18 @@ def classify_fault_bits(group_bits:dict):
report and a list of the undefined bits in the fault_report
'''

undefined_bits = []
undefined_bits = {}
unsupported_bits = {}
errorless_bits = {}
significant_bits = {}

# Iterate through each fault bit in the current bit group and classify fault bits
for fault_bit, bit_info in group_bits.items():
tile, rsrc, fctn, dsgn_rsrc, _, fault_msg, _, _ = bit_info
tile, rsrc, fctn, dsgn_rsrc, _, fault_msg, aff_rsrcs, _ = bit_info

# Classify fault bit by its significance and add it to its respective collections
if tile == 'NA':
undefined_bits.append(fault_bit)
undefined_bits[fault_bit] = aff_rsrcs
elif tile != 'NA' and 'not yet supported' in fault_msg:
unsupported_bits[fault_bit] = [tile, rsrc, fctn]
elif 'Not able to find any errors' in fault_msg or 'No instanced resource' in fault_msg:
Expand Down Expand Up @@ -234,9 +236,22 @@ def print_bit_group_section(section_name:str, section_bits, outfile:TextIOWrappe
gen_tcl_cmds(bit_info, outfile)

elif section_name == 'Undefined Bits':
# Print out each undefined bit
# Print out each undefined bit and its potential tiles
for bit in section_bits:
outfile.write(f'{bit}\n')
outfile.write('\tPotential Affected Resources:\n')

# Print each potential tile and its cells for the undefined bit
for tile, possible_aff_rsrcs in sorted(section_bits[bit].items()):
outfile.write(f'\t\t{tile}:\n')
for rsrc in sorted(possible_aff_rsrcs):
outfile.write(f'\t\t\t{rsrc}\n')
if possible_aff_rsrcs == []:
outfile.write('\t\t\tNo resources found for this tile\n')

if section_bits[bit] == {}:
outfile.write('\t\tNo potential tiles found')

outfile.write('\n')
else:
# Print out each error-less bit and bit information
Expand Down
4 changes: 2 additions & 2 deletions bitread.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
- List of all design bits in the format "bit_[base_frame]_[word_offset]_[bit_offset]"
'''

from lib.tile import XRAY_DB
from lib.tile import get_xray_dir

#################################################
# Helper functions #
Expand Down Expand Up @@ -194,7 +194,7 @@ def get_frame_list(part:str):
family = "zynq7"

# Open the part.json file for the part
with open(f"{XRAY_DB}/{family}/{part}/part.json", "r") as p_j:
with open(f"{get_xray_dir()}/{family}/{part}/part.json", "r") as p_j:

for line in p_j:
# Set corresponding bit for whether the frame's row is in the top or bottom half
Expand Down
2 changes: 1 addition & 1 deletion docs/sample_bit_scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ To run the script, simple provide the .ebd file and the number of bits to select
python3 essential_bits.py <ebd_file> <num_bits>
```

The script will generate a fault bit list containing the number of bits specified in the command-line interface.
The script will generate a fault bit list containing a random selection of the number of bits specified in the command-line interface.
Loading

0 comments on commit 7f8af08

Please sign in to comment.