Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added digilent genesys2 (kintex7) example #13

Open
wants to merge 3 commits into
base: xilinx
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions xilinx/examples/genesys2/Genesys2.xdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
set_property IOSTANDARD LVCMOS33 [get_ports led[0]]
set_property IOSTANDARD LVCMOS33 [get_ports led[1]]
set_property IOSTANDARD LVCMOS33 [get_ports led[2]]
set_property IOSTANDARD LVCMOS33 [get_ports led[3]]
set_property IOSTANDARD LVCMOS33 [get_ports led[4]]

set_property LOC T28 [get_ports led[0]]
set_property LOC V19 [get_ports led[1]]
set_property LOC U30 [get_ports led[2]]
set_property LOC U29 [get_ports led[3]]
set_property LOC V20 [get_ports led[4]]


set_property IOSTANDARD LVCMOS33 [get_ports sw[0]]
set_property IOSTANDARD LVCMOS33 [get_ports sw[1]]
set_property IOSTANDARD LVCMOS33 [get_ports sw[2]]
set_property IOSTANDARD LVCMOS33 [get_ports sw[3]]
set_property IOSTANDARD LVCMOS33 [get_ports sw[4]]
set_property IOSTANDARD LVCMOS33 [get_ports sw[5]]
set_property IOSTANDARD LVCMOS33 [get_ports sw[6]]
set_property IOSTANDARD LVCMOS33 [get_ports sw[7]]

set_property LOC G19 [get_ports sw[0]]
set_property LOC G25 [get_ports sw[1]]
set_property LOC H24 [get_ports sw[2]]
set_property LOC K19 [get_ports sw[3]]
set_property LOC N19 [get_ports sw[4]]
set_property LOC P19 [get_ports sw[5]]
set_property LOC P26 [get_ports sw[6]]
set_property LOC P27 [get_ports sw[7]]
21 changes: 21 additions & 0 deletions xilinx/examples/genesys2/kintex7patch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import json
import sys
NextPnrFile = sys.argv[1]
input_file = open(NextPnrFile, 'r')
data = json.loads(input_file.read())
input_file.close();

for cells in data['modules']['top']['cells']:
if (data['modules']['top']['cells'][cells]['type'] == 'PAD'):
data['modules']['top']['cells'][cells]['type'] = 'IOB_PAD'

if (data['modules']['top']['cells'][cells]['type'] == 'IOB33_INBUF_EN' or data['modules']['top']['cells'][cells]['type'] == 'IOB33_OUTBUF'):
first_inst = (data['modules']['top']['cells'][cells]['attributes']['NEXTPNR_BEL']).find('/')
if (first_inst >= 0):
second_inst = (data['modules']['top']['cells'][cells]['attributes']['NEXTPNR_BEL']).find('/',1+first_inst)
if (second_inst >= 0):
data['modules']['top']['cells'][cells]['attributes']['NEXTPNR_BEL']=data['modules']['top']['cells'][cells]['attributes']['NEXTPNR_BEL'][:first_inst]+data['modules']['top']['cells'][cells]['attributes']['NEXTPNR_BEL'][second_inst:];

output_file = open(NextPnrFile, 'w')
output_file.write(json.dumps(data,indent = 5, sort_keys=True))
output_file.close()
7 changes: 7 additions & 0 deletions xilinx/examples/genesys2/simpleCircuit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -ex
yosys -p "synth_xilinx -flatten -arch xc7 -nobram -nowidelut -top top; write_json simpleCircuit.json" simpleCircuit.v
../../../nextpnr-xilinx --chipdb ../../xc7k325t.bin --json simpleCircuit.json --xdc Genesys2.xdc --write simpleCircuit_routed.json
python kintex7patch.py simpleCircuit_routed.json
java -jar ../../../rapidwright_json2dcp.jar xc7k325tffg900-2 simpleCircuit_routed.json simpleCircuit.dcp
vivado -mode batch -nojournal -nolog -source simpleCircuit.tcl
4 changes: 4 additions & 0 deletions xilinx/examples/genesys2/simpleCircuit.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
open_checkpoint simpleCircuit.dcp
write_verilog -force simpleCircuit_out.v
set_property IS_LOC_FIXED true [get_ports]
write_bitstream -force simpleCircuit.bit
5 changes: 5 additions & 0 deletions xilinx/examples/genesys2/simpleCircuit.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module top (input [7:0] sw, output [4:0] led);

assign led = {1'b0,sw[3:0]} + {1'b0,sw[7:4]};

endmodule