Skip to content

Commit

Permalink
Merge pull request f4pga#727 from litghost/bufmrce
Browse files Browse the repository at this point in the history
Solve remaining bits in the ROI
  • Loading branch information
litghost committed Mar 22, 2019
2 parents a7066bb + c0b8c2b commit 5e9211d
Show file tree
Hide file tree
Showing 35 changed files with 2,330 additions and 344 deletions.
5 changes: 5 additions & 0 deletions fuzzers/005-tilegrid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ TILEGRID_TDB_DEPENDENCIES += cfg_int/build/segbits_tilegrid.tdb
TILEGRID_TDB_DEPENDENCIES += monitor_int/build/segbits_tilegrid.tdb
TILEGRID_TDB_DEPENDENCIES += clk_hrow/build/segbits_tilegrid.tdb
TILEGRID_TDB_DEPENDENCIES += clk_bufg/build/segbits_tilegrid.tdb
TILEGRID_TDB_DEPENDENCIES += hclk_cmt/build/segbits_tilegrid.tdb
GENERATE_FULL_ARGS=

ifeq (${XRAY_DATABASE}, zynq7)
Expand Down Expand Up @@ -104,6 +105,9 @@ clk_hrow/build/segbits_tilegrid.tdb: build/basicdb/tilegrid.json
clk_bufg/build/segbits_tilegrid.tdb: build/basicdb/tilegrid.json
cd clk_bufg && $(MAKE)

hclk_cmt/build/segbits_tilegrid.tdb: build/basicdb/tilegrid.json
cd hclk_cmt && $(MAKE)

build/tilegrid_tdb.json: add_tdb.py $(TILEGRID_TDB_DEPENDENCIES)
python3 add_tdb.py \
--fn-in build/basicdb/tilegrid.json \
Expand Down Expand Up @@ -139,6 +143,7 @@ clean:
cd orphan_int_column && $(MAKE) clean
cd clk_hrow && $(MAKE) clean
cd clk_bufg && $(MAKE) clean
cd hclk_cmt && $(MAKE) clean

.PHONY: database pushdb clean run

3 changes: 2 additions & 1 deletion fuzzers/005-tilegrid/add_tdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ def run(fn_in, fn_out, verbose=False):
("bram_block/build/segbits_tilegrid.tdb", 128, 10),
("clb/build/segbits_tilegrid.tdb", 36, 2),
("dsp/build/segbits_tilegrid.tdb", 28, 10),
("clk_hrow/build/segbits_tilegrid.tdb", 30, 7),
("clk_hrow/build/segbits_tilegrid.tdb", 30, 18),
("clk_bufg/build/segbits_tilegrid.tdb", 30, 8),
("hclk_cmt/build/segbits_tilegrid.tdb", 30, 10),
("clb_int/build/segbits_tilegrid.tdb", int_frames, int_words),
("iob_int/build/segbits_tilegrid.tdb", int_frames, int_words),
("bram_int/build/segbits_tilegrid.tdb", int_frames, int_words),
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/005-tilegrid/clk_hrow/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
N ?= 5
GENERATE_ARGS?="--oneval 1 --design params.csv --dword 1 --dframe 1A"
GENERATE_ARGS?="--oneval 1 --design params.csv --dword 6 --dframe 1A"
include ../fuzzaddr/common.mk

2 changes: 1 addition & 1 deletion fuzzers/005-tilegrid/generate_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def propagate_rebuf(database, tiles_by_grid):
rebuf_below]['type']

assert database[tile_name]['bits']['CLB_IO_CLK'][
'offset'] == 47, database[tile_name]['bits']['CLB_IO_CLK']
'offset'] == 42, database[tile_name]['bits']['CLB_IO_CLK']
database[rebuf_below]['bits'] = copy.deepcopy(
database[tile_name]['bits'])
database[rebuf_below]['bits']['CLB_IO_CLK']['offset'] = 73
Expand Down
4 changes: 4 additions & 0 deletions fuzzers/005-tilegrid/hclk_cmt/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
N ?= 5
GENERATE_ARGS?="--oneval 1 --design params.csv --dword 5 --dframe 1C"
include ../fuzzaddr/common.mk

3 changes: 3 additions & 0 deletions fuzzers/005-tilegrid/hclk_cmt/generate.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "$::env(XRAY_DIR)/utils/utils.tcl"

generate_top
66 changes: 66 additions & 0 deletions fuzzers/005-tilegrid/hclk_cmt/top.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import os
import random
random.seed(int(os.getenv("SEED"), 16))
from prjxray import util
from prjxray.db import Database


def gen_sites():
db = Database(util.get_db_root())
grid = db.grid()
for tile_name in sorted(grid.tiles()):
loc = grid.loc_of_tilename(tile_name)
gridinfo = grid.gridinfo_at_loc(loc)
sites = []
for site, site_type in gridinfo.sites.items():
if site_type == 'BUFMRCE':
sites.append(site)

if sites:
yield tile_name, sorted(sites)


def write_params(params):
pinstr = 'tile,val,site\n'
for tile, (site, val) in sorted(params.items()):
pinstr += '%s,%s,%s\n' % (tile, val, site)
open('params.csv', 'w').write(pinstr)


def run():
print('''
module top();
''')

params = {}

sites = list(gen_sites())
for (tile_name, sites), isone in zip(sites,
util.gen_fuzz_states(len(sites))):
site_name = sites[0]
params[tile_name] = (site_name, isone)

print(
'''
wire clk_{site};
(* KEEP, DONT_TOUCH, LOC = "{site}" *)
BUFMRCE #(
.INIT_OUT({isone})
) buf_{site} (
.O(clk_{site})
);
BUFR bufr_{site} (
.I(clk_{site})
);
'''.format(
site=site_name,
isone=isone,
))

print("endmodule")
write_params(params)


if __name__ == '__main__':
run()
79 changes: 38 additions & 41 deletions fuzzers/041-clk-hrow-pips/Makefile
Original file line number Diff line number Diff line change
@@ -1,65 +1,62 @@
export FUZDIR=$(shell pwd)
PIP_TYPE?=clk_hrow_bot
PIP_TYPE?=clk_hrow
PIPLIST_TCL=$(FUZDIR)/clk_hrow_pip_list.tcl

ifeq (${XRAY_PART}, xc7z010clg400-1)
# xc7z010clg400-1 is missing some side clock connections, so these bits cannot
# be documented.
TODO_RE="[^\.]+\.CLK_HROW_CK_MUX_OUT_[LR][0-9]+\.CLK_HROW_.*[KR_][0-9]+"
else
TODO_RE="[^\.]+\.CLK_HROW_CK_MUX_OUT_"
endif
TODO_RE=".*"

MAKETODO_FLAGS=--no-l --pip-type ${PIP_TYPE} --seg-type clk_hrow_bot --re $(TODO_RE)
MAKETODO_FLAGS=--sides "bot_r,top_r" --pip-type ${PIP_TYPE} --seg-type clk_hrow --re $(TODO_RE)
N = 50

# These PIPs all appear to be either a 1 bit solutions.
SEGMATCH_FLAGS=-c 1
# These PIPs all appear to be either a 2 bit solutions.
SEGMATCH_FLAGS=-c 2
SPECIMENS_DEPS=build/cmt_regions.csv
A_PIPLIST=clk_hrow_bot_r.txt

include ../pip_loop.mk

database: build/segbits_clk_hrow.db
database: build/segbits_clk_hrow_bot_r.rdb build/segbits_clk_hrow_top_r.rdb
${XRAY_DBFIXUP} --db-root build --zero-db bits.dbf \
--seg-fn-in build/segbits_clk_hrow_top_r.rdb \
--seg-fn-out build/segbits_clk_hrow_top_r.db
${XRAY_DBFIXUP} --db-root build --zero-db bits.dbf \
--seg-fn-in build/segbits_clk_hrow_bot_r.rdb \
--seg-fn-out build/segbits_clk_hrow_bot_r.db

build/cmt_regions.csv: output_cmt.tcl
mkdir -p build
cd build/ && ${XRAY_VIVADO} -mode batch -source ${FUZDIR}/output_cmt.tcl
# Keep a copy to track iter progress
cp build/segbits_clk_hrow_top_r.rdb build/$(ITER)/segbits_clk_hrow_top_r.rdb
cp build/segbits_clk_hrow_bot_r.rdb build/$(ITER)/segbits_clk_hrow_bot_r.rdb

build/segbits_clk_hrow.rdb: $(SPECIMENS_OK)
${XRAY_SEGMATCH} ${SEGMATCH_FLAGS} -o build/segbits_clk_hrow.rdb \
$(shell find build -name segdata_clk_hrow_top_r.txt) \
${XRAY_MASKMERGE} build/mask_clk_hrow_top_r.db \
$(shell find build -name segdata_clk_hrow_top_r.txt)
${XRAY_MASKMERGE} build/mask_clk_hrow_bot_r.db \
$(shell find build -name segdata_clk_hrow_bot_r.txt)

build/segbits_clk_hrow.db: build/segbits_clk_hrow.rdb piplist
${XRAY_DBFIXUP} --db-root build --zero-db bits.dbf \
--seg-fn-in build/segbits_clk_hrow.rdb \
--seg-fn-out build/segbits_clk_hrow_rc.db
# Clobber existing .db to eliminate potential conflicts
rm -f build/database/${XRAY_DATABASE}/*
cp ${XRAY_DATABASE_DIR}/${XRAY_DATABASE}/segbits*.db build/database/${XRAY_DATABASE}
XRAY_DATABASE_DIR=${FUZDIR}/build/database ${XRAY_MERGEDB} clk_hrow_bot_r build/segbits_clk_hrow_bot_r.db
XRAY_DATABASE_DIR=${FUZDIR}/build/database ${XRAY_MERGEDB} clk_hrow_top_r build/segbits_clk_hrow_top_r.db

# Convert row/column into PIP definition.
python3 merge_clk_entries.py \
build/segbits_clk_hrow_rc.db \
$(XRAY_FUZZERS_DIR)/piplist/build/${PIP_TYPE}/clk_hrow_bot_r.txt \
build/segbits_clk_hrow.db
build/cmt_regions.csv: output_cmt.tcl
mkdir -p build
cd build/ && ${XRAY_VIVADO} -mode batch -source ${FUZDIR}/output_cmt.tcl

# Keep a copy to track iter progress
cp build/segbits_clk_hrow.rdb build/$(ITER)/segbits_clk_hrow.rdb
cp build/segbits_clk_hrow_rc.db build/$(ITER)/segbits_clk_hrow_rc.db
generate: $(SPECIMENS_OK)

build/segbits_clk_hrow_top_r.rdb: $(SPECIMENS_OK)
${XRAY_SEGMATCH} ${SEGMATCH_FLAGS} -o build/segbits_clk_hrow_top_r.rdb \
$(shell find build -name segdata_clk_hrow_top_r.txt)

${XRAY_MASKMERGE} build/mask_clk_hrow.db \
$(shell find build -name segdata_clk_hrow_top_r.txt) \
build/segbits_clk_hrow_bot_r.rdb: $(SPECIMENS_OK)
${XRAY_SEGMATCH} ${SEGMATCH_FLAGS} -o build/segbits_clk_hrow_bot_r.rdb \
$(shell find build -name segdata_clk_hrow_bot_r.txt)

# Clobber existing .db to eliminate potential conflicts
cp ${XRAY_DATABASE_DIR}/${XRAY_DATABASE}/segbits*.db build/database/${XRAY_DATABASE}
XRAY_DATABASE_DIR=${FUZDIR}/build/database ${XRAY_MERGEDB} clk_hrow_bot_r build/segbits_clk_hrow.db
XRAY_DATABASE_DIR=${FUZDIR}/build/database ${XRAY_MERGEDB} clk_hrow_top_r build/segbits_clk_hrow.db
build/segbits_clk_hrow.db: build/segbits_clk_hrow_top_.rdb

pushdb: database
${XRAY_MERGEDB} clk_hrow_bot_r build/segbits_clk_hrow.db
${XRAY_MERGEDB} clk_hrow_top_r build/segbits_clk_hrow.db
${XRAY_MERGEDB} mask_clk_hrow_bot_r build/mask_clk_hrow.db
${XRAY_MERGEDB} mask_clk_hrow_top_r build/mask_clk_hrow.db
${XRAY_MERGEDB} clk_hrow_bot_r build/segbits_clk_hrow_bot_r.db
${XRAY_MERGEDB} clk_hrow_top_r build/segbits_clk_hrow_top_r.db
${XRAY_MERGEDB} mask_clk_hrow_bot_r build/mask_clk_hrow_bot_r.db
${XRAY_MERGEDB} mask_clk_hrow_top_r build/mask_clk_hrow_top_r.db

.PHONY: database pushdb
.PHONY: database pushdb generate
47 changes: 40 additions & 7 deletions fuzzers/041-clk-hrow-pips/clk_hrow_pip_list.tcl
Original file line number Diff line number Diff line change
@@ -1,12 +1,45 @@
proc print_tile_pips {tile_type filename} {
set tile [lindex [get_tiles -filter "TYPE == $tile_type"] 0]
puts "Dumping PIPs for tile $tile ($tile_type) to $filename."
set fp [open $filename w]
foreach pip [lsort [get_pips -of_objects [get_tiles $tile]]] {
set src [get_wires -uphill -of_objects $pip]
set dst [get_wires -downhill -of_objects $pip]
if {[llength [get_nodes -uphill -of_objects [get_nodes -of_objects $dst]]] != 1} {
puts $fp "$tile_type.[regsub {.*/} $dst ""].[regsub {.*/} $src ""]"
set pips [dict create]
foreach tile [get_tiles -filter "TYPE == $tile_type"] {
puts "Dumping PIPs for tile $tile ($tile_type) to $filename."
foreach pip [lsort [get_pips -of_objects $tile]] {
set src [get_wires -uphill -of_objects $pip]
set dst [get_wires -downhill -of_objects $pip]

# Skip pips with disconnected nodes
set src_node [get_nodes -of_objects $src]
if { $src_node == {} } {
continue
}

set dst_node [get_nodes -of_objects $src]
if { $dst_node == {} } {
continue
}

# TODO: Support CLK sources from GTX hardblocks.
if [string match *GTX* $src_node] {
continue
}

# Some ports appear to be just test signals, ignore these.
if [string match *TESTPLL* $src_node] {
continue
}

# TODO: Support CLK sources from PS7 hardblock
if [string match *PSS_HCLK* $src_node] {
continue
}

if {[llength [get_nodes -uphill -of_objects [get_nodes -of_objects $dst]]] != 1} {
set pip_string "$tile_type.[regsub {.*/} $dst ""].[regsub {.*/} $src ""]"
if ![dict exists $pips $pip_string] {
puts $fp $pip_string
dict set pips $pip_string 1
}
}
}
}
close $fp
Expand Down
34 changes: 0 additions & 34 deletions fuzzers/041-clk-hrow-pips/clk_table.py

This file was deleted.

0 comments on commit 5e9211d

Please sign in to comment.