Merge pull request #52 from mcmasterg/roi_harness

Roi harness
This commit is contained in:
Rick Altherr 2018-01-18 20:33:07 -08:00 committed by GitHub
commit c38907cd73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 239 additions and 96 deletions

View File

@ -6,3 +6,4 @@
/usage_statistics_webtalk.*
/vivado*
/design.txt
/out_*

View File

@ -3,6 +3,7 @@ all:
clean:
rm -rf specimen_[0-9][0-9][0-9]/ seg_clblx.segbits vivado*.log vivado_*.str vivado*.jou design *.bits *.dcp *.bit design.txt .Xil
rm -rf out_* *~
.PHONY: all clean

View File

@ -10,3 +10,10 @@ There is no logic outside of the ROI in order to keep IOB to ROI delays short
Its expected the end user will rip out everything inside the ROI
To target Arty A7 you should source the artix DB environment script then source arty.sh
To build the baseline harness:
make
To build a sample design using the harness:
XRAY_ROIV=roi_inv.v make

View File

@ -1 +1,3 @@
export XRAY_PART=xc7a35tcsg324-1
export XRAY_PINCFG=ARTY-A7-SWBUT

View File

@ -0,0 +1,14 @@
# XC7A35T-1CPG236C
export XRAY_PART=xc7a35tcpg236-1
export XRAY_PINCFG=BASYS3-SWBUT
# For generating DB
export XRAY_PIN_00="V17"
export XRAY_PIN_01="V16"
export XRAY_PIN_02="W16"
export XRAY_PIN_03="W17"
export XRAY_PIN_04="W15"
export XRAY_PIN_05="V15"
export XRAY_PIN_06="W14"
export XRAY_BITREAD="$XRAY_DIR/build/tools/bitread -part_file $XRAY_DIR/database/artix7/xc7a35tcpg236-1.yaml"

View File

@ -0,0 +1,8 @@
`ifndef DIN_N
`define DIN_N 8
`endif
`ifndef DOUT_N
`define DOUT_N 8
`endif

View File

@ -0,0 +1,49 @@
//See README and tcl for more info
`include "defines.v"
module roi(input clk,
input [DIN_N-1:0] din, output [DOUT_N-1:0] dout);
parameter DIN_N = `DIN_N;
parameter DOUT_N = `DOUT_N;
genvar i;
generate
//CLK
(* KEEP, DONT_TOUCH *)
reg clk_reg;
always @(posedge clk) begin
clk_reg <= clk_reg;
end
//DIN
for (i = 0; i < DIN_N; i = i+1) begin:ins
(* KEEP, DONT_TOUCH *)
LUT6 #(
.INIT(64'b01)
) lut (
.I0(din[i]),
.I1(1'b0),
.I2(1'b0),
.I3(1'b0),
.I4(1'b0),
.I5(1'b0),
.O());
end
//DOUT
for (i = 0; i < DOUT_N; i = i+1) begin:outs
(* KEEP, DONT_TOUCH *)
LUT6 #(
.INIT(64'b01)
) lut (
.I0(1'b0),
.I1(1'b0),
.I2(1'b0),
.I3(1'b0),
.I4(1'b0),
.I5(1'b0),
.O(dout[i]));
end
endgenerate
endmodule

View File

@ -0,0 +1,53 @@
//Connect the switches to the LEDs, inverting the signal in the ROI
//Assumes # inputs = # outputs
`include "defines.v"
module roi(input clk,
input [DIN_N-1:0] din, output [DOUT_N-1:0] dout);
parameter DIN_N = `DIN_N;
parameter DOUT_N = `DOUT_N;
wire [DIN_N-1:0] internal;
genvar i;
generate
//CLK
(* KEEP, DONT_TOUCH *)
reg clk_reg;
always @(posedge clk) begin
clk_reg <= clk_reg;
end
//DIN
for (i = 0; i < DIN_N; i = i+1) begin:ins
//Very expensive inverter
(* KEEP, DONT_TOUCH *)
LUT6 #(
.INIT(64'b01)
) lut (
.I0(din[i]),
.I1(1'b0),
.I2(1'b0),
.I3(1'b0),
.I4(1'b0),
.I5(1'b0),
.O(internal[i]));
end
//DOUT
for (i = 0; i < DOUT_N; i = i+1) begin:outs
//Very expensive buffer
(* KEEP, DONT_TOUCH *)
LUT6 #(
.INIT(64'b010)
) lut (
.I0(internal[i]),
.I1(1'b0),
.I2(1'b0),
.I3(1'b0),
.I4(1'b0),
.I5(1'b0),
.O(dout[i]));
end
endgenerate
endmodule

View File

@ -1,6 +1,13 @@
#!/bin/bash
set -ex
rm -f out_last
vivado -mode batch -source runme.tcl
test -z "$(fgrep CRITICAL vivado.log)"
pushd out_last
${XRAY_BITREAD} -F $XRAY_ROI_FRAMES -o design.bits -z -y design.bit
${XRAY_SEGPRINT} -zd design.bits >design.segp
${XRAY_DIR}/tools/segprint2fasm.py design.segp design.fasm
${XRAY_DIR}/tools/fasm2frame.py design.fasm design.frm
popd

View File

@ -32,17 +32,34 @@ set Y_DIN_BASE [expr "$Y_CLK_BASE + 1"]
# Note: can actually go up one more if we want
set Y_DOUT_BASE [expr "$XRAY_ROI_Y1 - $DIN_N * $PITCH"]
set part "$::env(XRAY_PART)"
set pincfg ""
if { [info exists ::env(XRAY_PINCFG) ] } {
set pincfg "$::env(XRAY_PINCFG)"
}
set roiv "roi_base.v"
if { [info exists ::env(XRAY_ROIV) ] } {
set roiv "$::env(XRAY_ROIV)"
}
set roiv_trim [string map {.v v} $roiv]
set outdir "out_${part}_${pincfg}_${roiv_trim}"
puts "Environment"
puts " XRAY_ROI: $::env(XRAY_ROI)"
puts " X_BASE: $X_BASE"
puts " Y_DIN_BASE: $Y_DIN_BASE"
puts " Y_CLK_BASE: $Y_CLK_BASE"
puts " Y_DOUT_BASE: $Y_DOUT_BASE"
puts " outdir: $outdir"
file mkdir $outdir
file link -symbolic out_last $outdir
source ../../utils/utils.tcl
create_project -force -part $::env(XRAY_PART) design design
read_verilog top.v
read_verilog $roiv
# added flatten_hierarchy
# dout_shr was getting folded into the pblock
# synth_design -top top -flatten_hierarchy none -no_lc -keep_equivalent_registers -resource_sharing off
@ -52,7 +69,6 @@ synth_design -top top -flatten_hierarchy none -verilog_define DIN_N=$DIN_N -veri
array set net2pin [list]
# Create pin assignments based on what we are targetting
set part "$::env(XRAY_PART)"
# A50T I/O Bank 16 sequential layout
if {$part eq "xc7a50tfgg484-1"} {
# Partial list, expand as needed
@ -77,54 +93,84 @@ if {$part eq "xc7a50tfgg484-1"} {
incr banki
set net2pin(dout[$i]) $pin
}
# Arty A7 switch, button, and LED
} elseif {$part eq "xc7a35tcsg324-1"} {
# https://reference.digilentinc.com/reference/programmable-logic/arty/reference-manual?redirect=1
# 4 switches then 4 buttons
set sw_but "A8 C11 C10 A10 D9 C9 B9 B8"
# 4 LEDs then 4 RGB LEDs (green only)
set leds "H5 J5 T9 T10 F6 J4 J2 H6"
# Arty A7 switch, button, and LED
if {$pincfg eq "ARTY-A7-SWBUT"} {
# https://reference.digilentinc.com/reference/programmable-logic/arty/reference-manual?redirect=1
# 4 switches then 4 buttons
set sw_but "A8 C11 C10 A10 D9 C9 B9 B8"
# 4 LEDs then 4 RGB LEDs (green only)
set leds "H5 J5 T9 T10 F6 J4 J2 H6"
# 100 MHz CLK onboard
set pin "E3"
set net2pin(clk) $pin
# 100 MHz CLK onboard
set pin "E3"
set net2pin(clk) $pin
# DIN
for {set i 0} {$i < $DIN_N} {incr i} {
set pin [lindex $sw_but $i]
set net2pin(din[$i]) $pin
# DIN
for {set i 0} {$i < $DIN_N} {incr i} {
set pin [lindex $sw_but $i]
set net2pin(din[$i]) $pin
}
# DOUT
for {set i 0} {$i < $DOUT_N} {incr i} {
set pin [lindex $leds $i]
set net2pin(dout[$i]) $pin
}
# Arty A7 pmod
# Disabled per above
} elseif {$pincfg eq "ARTY-A7-PMOD"} {
# https://reference.digilentinc.com/reference/programmable-logic/arty/reference-manual?redirect=1
set pmod_ja "G13 B11 A11 D12 D13 B18 A18 K16"
set pmod_jb "E15 E16 D15 C15 J17 J18 K15 J15"
set pmod_jc "U12 V12 V10 V11 U14 V14 T13 U13"
# CLK on Pmod JA
set pin [lindex $pmod_ja 0]
set net2pin(clk) $pin
# DIN on Pmod JB
for {set i 0} {$i < $DIN_N} {incr i} {
set pin [lindex $pmod_jb $i]
set net2pin(din[$i]) $pin
}
# DOUT on Pmod JC
for {set i 0} {$i < $DOUT_N} {incr i} {
set pin [lindex $pmod_jc $i]
set net2pin(dout[$i]) $pin
}
} else {
error "Unsupported config $pincfg"
}
} elseif {$part eq "xc7a35tcpg236-1"} {
if {$pincfg eq "BASYS3-SWBUT"} {
# https://raw.githubusercontent.com/Digilent/digilent-xdc/master/Basys-3-Master.xdc
# DOUT
for {set i 0} {$i < $DOUT_N} {incr i} {
set pin [lindex $leds $i]
set net2pin(dout[$i]) $pin
}
# Arty A7 pmod
# Disabled per above
} elseif {$part eq "xc7a35tcsg324-1"} {
# https://reference.digilentinc.com/reference/programmable-logic/arty/reference-manual?redirect=1
set pmod_ja "G13 B11 A11 D12 D13 B18 A18 K16"
set pmod_jb "E15 E16 D15 C15 J17 J18 K15 J15"
set pmod_jc "U12 V12 V10 V11 U14 V14 T13 U13"
# Slide switches
set sws "V17 V16 W16 W17 W15 V15 W14 W13 V2 T3 T2 R3 W2 U1 T1 R2"
set leds "U16 E19 U19 V19 W18 U15 U14 V14 V13 V3 W3 U3 P3 N3 P1 L1"
# CLK on Pmod JA
set pin [lindex $pmod_ja 0]
set net2pin(clk) $pin
# 100 MHz CLK onboard
set pin "W5"
set net2pin(clk) $pin
# DIN on Pmod JB
for {set i 0} {$i < $DIN_N} {incr i} {
set pin [lindex $pmod_jb $i]
set net2pin(din[$i]) $pin
# DIN
for {set i 0} {$i < $DIN_N} {incr i} {
set pin [lindex $sws $i]
set net2pin(din[$i]) $pin
}
# DOUT
for {set i 0} {$i < $DOUT_N} {incr i} {
set pin [lindex $leds $i]
set net2pin(dout[$i]) $pin
}
} else {
error "Unsupported config $pincfg"
}
# DOUT on Pmod JC
for {set i 0} {$i < $DOUT_N} {incr i} {
set pin [lindex $pmod_jc $i]
set net2pin(dout[$i]) $pin
}
} else {
error "Unsupported part $part"
error "Pins: unsupported part $part"
}
# Now actually apply the pin definitions
@ -338,8 +384,11 @@ if {1} {
} elseif {$part eq "xc7a35tcsg324-1"} {
set node "INT_L_X10Y${y}/SW6BEG0"
route_via2 "roi/dout[$i]" "$node"
} elseif {$part eq "xc7a35tcpg236-1"} {
set node "INT_L_X10Y${y}/SW6BEG0"
route_via2 "roi/dout[$i]" "$node"
} else {
error "Unsupported part $part"
error "Routing: unsupported part $part"
}
# XXX: only care about right ports on Arty
} else {
@ -357,6 +406,7 @@ close $fp
puts "routing design"
route_design
write_checkpoint -force design.dcp
write_bitstream -force design.bit
write_checkpoint -force $outdir/design.dcp
set_property BITSTREAM.GENERAL.DEBUGBITSTREAM YES [current_design]
write_bitstream -force $outdir/design.bit

View File

@ -1,12 +1,6 @@
//See README and tcl for more info
`ifndef DIN_N
`define DIN_N 4
`endif
`ifndef DOUT_N
`define DOUT_N 4
`endif
`include "defines.v"
module top(input wire clk,
input [DIN_N-1:0] din, output [DOUT_N-1:0] dout);
@ -18,48 +12,3 @@ module top(input wire clk,
.din(din), .dout(dout));
endmodule
module roi(input clk,
input [DIN_N-1:0] din, output [DOUT_N-1:0] dout);
parameter DIN_N = 4;
parameter DOUT_N = 4;
genvar i;
generate
//CLK
(* KEEP, DONT_TOUCH *)
reg clk_reg;
always @(posedge clk) begin
clk_reg <= clk_reg;
end
//DIN
for (i = 0; i < DIN_N; i = i+1) begin:ins
(* KEEP, DONT_TOUCH *)
LUT6 #(
.INIT(64'b01)
) lut (
.I0(din[i]),
.I1(1'b0),
.I2(1'b0),
.I3(1'b0),
.I4(1'b0),
.I5(1'b0),
.O());
end
//DOUT
for (i = 0; i < DOUT_N; i = i+1) begin:outs
(* KEEP, DONT_TOUCH *)
LUT6 #(
.INIT(64'b01)
) lut (
.I0(1'b0),
.I1(1'b0),
.I2(1'b0),
.I3(1'b0),
.I4(1'b0),
.I5(1'b0),
.O(dout[i]));
end
endgenerate
endmodule

1
tools/fasm2frame.py Normal file → Executable file
View File

@ -183,6 +183,7 @@ def run(f_in, f_out, sparse=False, debug=False):
'INT_L': int2dbkey,
'INT_R': int2dbkey,
'HCLK_L': int2dbkey,
'HCLK_R': int2dbkey,
}
f = tile2dbkey.get(tilej['type'], None)

3
tools/segprint2fasm.py Normal file → Executable file
View File

@ -61,10 +61,11 @@ def tag2fasm(grid, seg, tag):
'INT_L': intf,
'INT_R': intf,
'HCLK_L': intf,
'HCLK_R': intf,
}
f = tag2asm.get(tile_type, None)
if f is None:
raise Exception("Unhandled segment type %s" % tilej['type'])
raise Exception("Unhandled segment type %s" % tile_type)
return f(seg, tile, tag_post)