mirror of https://github.com/openXC7/prjxray.git
fuzzers: refactor fuzzer 51
The fuzzer is now todo files based. It is also using generic generate.py script. For now the fuzzer instantiates picorv and randluts besides the logic under test. This is required for to deliver negative examples to segmaker. Because of the size of the design this fuzzer is taking really long to complete. We need to find a smallest possible design that will be enough to generate the DB. Signed-off-by: Karol Gugala <kgugala@antmicro.com>
This commit is contained in:
parent
e6eb0db9f9
commit
a4b0c6f1de
|
|
@ -1,68 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import re, os
|
||||
|
||||
from prjxray.segmaker import Segmaker
|
||||
|
||||
segmk = Segmaker("design.bits")
|
||||
|
||||
tiledata = dict()
|
||||
pipdata = dict()
|
||||
ignpip = set()
|
||||
|
||||
print("Loading tags from design.txt.")
|
||||
with open("design.txt", "r") as f:
|
||||
for line in f:
|
||||
tile, pip, src, dst, pnum, pdir = line.split()
|
||||
_, pip = pip.split(".")
|
||||
_, src = src.split("/")
|
||||
_, dst = dst.split("/")
|
||||
pnum = int(pnum)
|
||||
pdir = int(pdir)
|
||||
|
||||
if tile not in tiledata:
|
||||
tiledata[tile] = {"pips": set(), "srcs": set(), "dsts": set()}
|
||||
|
||||
if pip in pipdata:
|
||||
assert pipdata[pip] == (src, dst)
|
||||
else:
|
||||
pipdata[pip] = (src, dst)
|
||||
|
||||
tiledata[tile]["pips"].add(pip)
|
||||
tiledata[tile]["srcs"].add(src)
|
||||
tiledata[tile]["dsts"].add(dst)
|
||||
|
||||
if pdir == 0:
|
||||
tiledata[tile]["srcs"].add(dst)
|
||||
tiledata[tile]["dsts"].add(src)
|
||||
|
||||
if pnum == 1 or pdir == 0 or \
|
||||
re.match(r"^(L[HV]B?|G?CLK)(_L)?(_B)?[0-9]", src) or \
|
||||
re.match(r"^(L[HV]B?|G?CLK)(_L)?(_B)?[0-9]", dst) or \
|
||||
re.match(r"^(CTRL|GFAN)(_L)?[0-9]", dst):
|
||||
ignpip.add(pip)
|
||||
|
||||
for tile, pips_srcs_dsts in tiledata.items():
|
||||
pips = pips_srcs_dsts["pips"]
|
||||
srcs = pips_srcs_dsts["srcs"]
|
||||
dsts = pips_srcs_dsts["dsts"]
|
||||
|
||||
for pip, src_dst in pipdata.items():
|
||||
src, dst = src_dst
|
||||
if pip in ignpip:
|
||||
pass
|
||||
elif pip in pips:
|
||||
segmk.add_tile_tag(tile, "%s.%s" % (dst, src), 1)
|
||||
elif src_dst[1] not in dsts:
|
||||
segmk.add_tile_tag(tile, "%s.%s" % (dst, src), 0)
|
||||
|
||||
|
||||
def bitfilter(frame_idx, bit_idx):
|
||||
assert os.getenv("XRAY_DATABASE") in ["artix7", "kintex7"]
|
||||
if frame_idx in [30, 31]:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
segmk.compile(bitfilter=bitfilter)
|
||||
segmk.write(allow_empty=True)
|
||||
|
|
@ -0,0 +1 @@
|
|||
../int_generate.py
|
||||
|
|
@ -3,10 +3,13 @@ source "$::env(XRAY_DIR)/utils/utils.tcl"
|
|||
create_project -force -part $::env(XRAY_PART) design design
|
||||
|
||||
read_verilog $::env(FUZDIR)/top.v
|
||||
read_verilog $::env(FUZDIR)/picorv32.v
|
||||
synth_design -top top
|
||||
|
||||
set_property -dict "PACKAGE_PIN $::env(XRAY_PIN_00) IOSTANDARD LVCMOS33" [get_ports i]
|
||||
set_property -dict "PACKAGE_PIN $::env(XRAY_PIN_01) IOSTANDARD LVCMOS33" [get_ports o]
|
||||
set_property -dict "PACKAGE_PIN $::env(XRAY_PIN_00) IOSTANDARD LVCMOS33" [get_ports clk]
|
||||
set_property -dict "PACKAGE_PIN $::env(XRAY_PIN_01) IOSTANDARD LVCMOS33" [get_ports din]
|
||||
set_property -dict "PACKAGE_PIN $::env(XRAY_PIN_02) IOSTANDARD LVCMOS33" [get_ports dout]
|
||||
set_property -dict "PACKAGE_PIN $::env(XRAY_PIN_03) IOSTANDARD LVCMOS33" [get_ports stb]
|
||||
|
||||
create_pblock roi
|
||||
resize_pblock [get_pblocks roi] -add "$::env(XRAY_ROI)"
|
||||
|
|
@ -14,6 +17,8 @@ resize_pblock [get_pblocks roi] -add "$::env(XRAY_ROI)"
|
|||
set_property CFGBVS VCCO [current_design]
|
||||
set_property CONFIG_VOLTAGE 3.3 [current_design]
|
||||
set_property BITSTREAM.GENERAL.PERFRAMECRC YES [current_design]
|
||||
|
||||
set_property CLOCK_DEDICATED_ROUTE FALSE [get_nets clk_IBUF]
|
||||
set_param tcl.collectionResultDisplayLimit 0
|
||||
|
||||
place_design
|
||||
|
|
@ -21,7 +26,6 @@ route_design
|
|||
|
||||
# write_checkpoint -force design.dcp
|
||||
|
||||
|
||||
set fp [open "../../todo.txt" r]
|
||||
set todo_lines {}
|
||||
for {gets $fp line} {$line != ""} {gets $fp line} {
|
||||
|
|
@ -29,8 +33,8 @@ for {gets $fp line} {$line != ""} {gets $fp line} {
|
|||
}
|
||||
close $fp
|
||||
|
||||
set int_l_tiles [randsample_list [llength $todo_lines] [filter [pblock_tiles roi] {TYPE == INT_L}]]
|
||||
set int_r_tiles [randsample_list [llength $todo_lines] [filter [pblock_tiles roi] {TYPE == INT_R}]]
|
||||
set int_l_tiles [filter [pblock_tiles roi] {TYPE == INT_L}]]
|
||||
set int_r_tiles [filter [pblock_tiles roi] {TYPE == INT_R}]]
|
||||
|
||||
for {set idx 0} {$idx < [llength $todo_lines]} {incr idx} {
|
||||
set line [lindex $todo_lines $idx]
|
||||
|
|
@ -51,18 +55,37 @@ for {set idx 0} {$idx < [llength $todo_lines]} {incr idx} {
|
|||
set src_prefix [regsub {(.*/.).*} ${clb_src_pin} {\1}]
|
||||
set dst_prefix [regsub {(.*/.).*} ${clb_dst_pin} {\1}]
|
||||
|
||||
if {$src_prefix == $dst_prefix} {
|
||||
set slice [get_sites -of_objects $clb_dst_pin]
|
||||
set lut [regsub {.*/} $src_prefix {}]6LUT
|
||||
set slice [get_sites -of_objects $clb_dst_pin]
|
||||
set src_slice [get_sites -of_objects $clb_src_pin]
|
||||
set lut [regsub {.*/} $src_prefix {}]6LUT
|
||||
set dff [regsub {.*/} $src_prefix {}]FF
|
||||
|
||||
puts "=== $slice $lut ($clb_src_pin -> $clb_dst_pin)"
|
||||
set mynet [create_net mynet_$idx]
|
||||
set mylut [create_cell -reference LUT1 mylut_$idx]
|
||||
set lutin [regsub {.*(.)} $clb_dst_pin {A\1}]
|
||||
set_property -dict "LOC $slice BEL $lut LOCK_PINS I0:$lutin" $mylut
|
||||
|
||||
set mynet [create_net mynet_$idx]
|
||||
set mylut [create_cell -reference LUT1 mylut_$idx]
|
||||
set lutin [regsub {.*(.)} $clb_dst_pin {A\1}]
|
||||
set_property -dict "LOC $slice BEL $lut LOCK_PINS I0:$lutin" $mylut
|
||||
# some source wires may be FF outputs, in such cases
|
||||
# we need to place and route an FF
|
||||
|
||||
set src_type [regsub {.*/*(.$)} $clb_src_pin {\1}]
|
||||
if { $src_type == "Q" } {
|
||||
set mydff [create_cell -reference FDCE mydff_$idx]
|
||||
set_property -dict "LOC $src_slice BEL $dff" $mydff
|
||||
connect_net -net $mynet -objects "$mylut/I0 $mydff/Q"
|
||||
} else {
|
||||
connect_net -net $mynet -objects "$mylut/I0 $mylut/O"
|
||||
}
|
||||
|
||||
set route_list "$tile/$src_wire $tile/$dst_wire"
|
||||
puts "route_via $mynet $route_list"
|
||||
set rc [route_via $mynet $route_list 0]
|
||||
if {$rc != 0} {
|
||||
puts "SUCCESS"
|
||||
} else {
|
||||
puts "Manual routing failed"
|
||||
# TODO: We should probably fail here
|
||||
}
|
||||
}
|
||||
|
||||
proc write_txtdata {filename} {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,3 +1,93 @@
|
|||
module top (input i, output o);
|
||||
assign o = i;
|
||||
`include "setseed.vh"
|
||||
|
||||
module top(input clk, din, stb, output dout);
|
||||
reg [41:0] din_bits;
|
||||
wire [78:0] dout_bits;
|
||||
|
||||
reg [41:0] din_shr;
|
||||
reg [78:0] dout_shr;
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (stb) begin
|
||||
din_bits <= din_shr;
|
||||
dout_shr <= dout_bits;
|
||||
end else begin
|
||||
din_shr <= {din_shr, din};
|
||||
dout_shr <= {dout_shr, din_shr[41]};
|
||||
end
|
||||
end
|
||||
|
||||
assign dout = dout_shr[78];
|
||||
|
||||
roi roi (
|
||||
.clk(clk),
|
||||
.din_bits(din_bits),
|
||||
.dout_bits(dout_bits)
|
||||
);
|
||||
endmodule
|
||||
|
||||
module roi(input clk, input [41:0] din_bits, output [78:0] dout_bits);
|
||||
picorv32 picorv32 (
|
||||
.clk(clk),
|
||||
.resetn(din_bits[0]),
|
||||
.mem_valid(dout_bits[0]),
|
||||
.mem_instr(dout_bits[1]),
|
||||
.mem_ready(din_bits[1]),
|
||||
.mem_addr(dout_bits[33:2]),
|
||||
.mem_wdata(dout_bits[66:34]),
|
||||
.mem_wstrb(dout_bits[70:67]),
|
||||
.mem_rdata(din_bits[33:2])
|
||||
);
|
||||
|
||||
randluts randluts (
|
||||
.din(din_bits[41:34]),
|
||||
.dout(dout_bits[78:71])
|
||||
);
|
||||
endmodule
|
||||
|
||||
module randluts(input [7:0] din, output [7:0] dout);
|
||||
localparam integer N =
|
||||
`SEED % 3 == 2 ? 250 :
|
||||
`SEED % 3 == 1 ? 100 : 10;
|
||||
|
||||
function [31:0] xorshift32(input [31:0] xorin);
|
||||
begin
|
||||
xorshift32 = xorin;
|
||||
xorshift32 = xorshift32 ^ (xorshift32 << 13);
|
||||
xorshift32 = xorshift32 ^ (xorshift32 >> 17);
|
||||
xorshift32 = xorshift32 ^ (xorshift32 << 5);
|
||||
end
|
||||
endfunction
|
||||
|
||||
function [63:0] lutinit(input [7:0] a, b);
|
||||
begin
|
||||
lutinit[63:32] = xorshift32(xorshift32(xorshift32(xorshift32({a, b} ^ `SEED))));
|
||||
lutinit[31: 0] = xorshift32(xorshift32(xorshift32(xorshift32({b, a} ^ `SEED))));
|
||||
end
|
||||
endfunction
|
||||
|
||||
wire [(N+1)*8-1:0] nets;
|
||||
|
||||
assign nets[7:0] = din;
|
||||
assign dout = nets[(N+1)*8-1:N*8];
|
||||
|
||||
genvar i, j;
|
||||
generate
|
||||
for (i = 0; i < N; i = i+1) begin:is
|
||||
for (j = 0; j < 8; j = j+1) begin:js
|
||||
localparam integer k = xorshift32(xorshift32(xorshift32(xorshift32((i << 20) ^ (j << 10) ^ `SEED)))) & 255;
|
||||
LUT6 #(
|
||||
.INIT(lutinit(i, j))
|
||||
) lut (
|
||||
.I0(nets[8*i+(k+0)%8]),
|
||||
.I1(nets[8*i+(k+1)%8]),
|
||||
.I2(nets[8*i+(k+2)%8]),
|
||||
.I3(nets[8*i+(k+3)%8]),
|
||||
.I4(nets[8*i+(k+4)%8]),
|
||||
.I5(nets[8*i+(k+5)%8]),
|
||||
.O(nets[8*i+8+j])
|
||||
);
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
endmodule
|
||||
|
|
|
|||
Loading…
Reference in New Issue