HeavyX/examples/helloworld_kintex7.nix

48 lines
1.4 KiB
Nix
Raw Normal View History

2019-06-06 17:25:11 +08:00
{ pkgs, hx }:
2019-03-25 16:10:07 +08:00
let
2019-04-26 17:42:03 +08:00
vivadoInput = pkgs.runCommand "helloworld-vivado-input" {
2019-06-06 17:25:11 +08:00
buildInputs = [ (pkgs.python3.withPackages(ps: [hx.drvs.nmigen hx.drvs.heavycomps])) hx.drvs.yosys ];
2019-03-25 16:10:07 +08:00
}
''
mkdir $out
2019-04-26 16:59:19 +08:00
python ${./helloworld_kintex7.py} > $out/top.v
2019-03-25 16:10:07 +08:00
cat > $out/top.xdc << EOF
set_property LOC K24 [get_ports serial_tx]
set_property IOSTANDARD LVCMOS25 [get_ports serial_tx]
set_property LOC K28 [get_ports clk156_p]
set_property IOSTANDARD LVDS_25 [get_ports clk156_p]
set_property DIFF_TERM TRUE [get_ports clk156_p]
set_property LOC K29 [get_ports clk156_n]
set_property IOSTANDARD LVDS_25 [get_ports clk156_n]
set_property DIFF_TERM TRUE [get_ports clk156_n]
create_clock -name clk156 -period 6.4 [get_nets clk156_p]
EOF
cat > $out/top.tcl << EOF
create_project -force -name top -part xc7k325t-ffg900-2
set_property XPM_LIBRARIES {XPM_CDC XPM_MEMORY} [current_project]
add_files {top.v}
set_property library work [get_files {top.v}]
read_xdc top.xdc
synth_design -top top -part xc7k325t-ffg900-2
opt_design
place_design
route_design
set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 4 [current_design]
set_property BITSTREAM.GENERAL.COMPRESS True [current_design]
write_bitstream -force top.bit
quit
EOF
'';
in
2019-06-06 17:25:11 +08:00
hx.lib.vivado.buildBitstream {
2019-04-26 17:42:03 +08:00
name = "helloworld-bitstream";
2019-03-25 16:10:07 +08:00
src = vivadoInput;
}