Add pyfpga to gen xc7z010.
This commit is contained in:
parent
148c4c2d4b
commit
8171eabec1
|
@ -0,0 +1 @@
|
|||
build
|
|
@ -0,0 +1,82 @@
|
|||
//`include "global_define.v"
|
||||
|
||||
module TOP(
|
||||
inout wire [14:0] DDR_addr,
|
||||
inout wire [2:0] DDR_ba,
|
||||
inout wire DDR_cas_n,
|
||||
inout wire DDR_ck_n,
|
||||
inout wire DDR_ck_p,
|
||||
inout wire DDR_cke,
|
||||
inout wire DDR_cs_n,
|
||||
inout wire [3:0] DDR_dm,
|
||||
inout wire [31:0] DDR_dq,
|
||||
inout wire [3:0] DDR_dqs_n,
|
||||
inout wire [3:0] DDR_dqs_p,
|
||||
inout wire DDR_odt,
|
||||
inout wire DDR_ras_n,
|
||||
inout wire DDR_reset_n,
|
||||
inout wire DDR_we_n,
|
||||
inout wire FIXED_IO_ddr_vrn,
|
||||
inout wire FIXED_IO_ddr_vrp,
|
||||
inout wire [53:0] FIXED_IO_mio,
|
||||
inout wire FIXED_IO_ps_clk,
|
||||
inout wire FIXED_IO_ps_porb,
|
||||
inout wire FIXED_IO_ps_srstb,
|
||||
|
||||
//misc
|
||||
//input wire key,
|
||||
output wire led1,
|
||||
output wire led2,
|
||||
output wire led3,
|
||||
|
||||
input wire uart_rx,
|
||||
output wire uart_tx
|
||||
);
|
||||
|
||||
// assign led1 = ~vout_lvds_mmcm_locked;
|
||||
// assign led2 = ~led_b;
|
||||
wire led_b;
|
||||
wire clk_axi;
|
||||
|
||||
design_1 u_bd(
|
||||
.DDR_addr (DDR_addr ),
|
||||
.DDR_ba (DDR_ba ),
|
||||
.DDR_cas_n (DDR_cas_n ),
|
||||
.DDR_ck_n (DDR_ck_n ),
|
||||
.DDR_ck_p (DDR_ck_p ),
|
||||
.DDR_cke (DDR_cke ),
|
||||
.DDR_cs_n (DDR_cs_n ),
|
||||
.DDR_dm (DDR_dm ),
|
||||
.DDR_dq (DDR_dq ),
|
||||
.DDR_dqs_n (DDR_dqs_n ),
|
||||
.DDR_dqs_p (DDR_dqs_p ),
|
||||
.DDR_odt (DDR_odt ),
|
||||
.DDR_ras_n (DDR_ras_n ),
|
||||
.DDR_reset_n (DDR_reset_n ),
|
||||
.DDR_we_n (DDR_we_n ),
|
||||
.FIXED_IO_ddr_vrn (FIXED_IO_ddr_vrn ),
|
||||
.FIXED_IO_ddr_vrp (FIXED_IO_ddr_vrp ),
|
||||
.FIXED_IO_mio (FIXED_IO_mio ),
|
||||
.FIXED_IO_ps_clk (FIXED_IO_ps_clk ),
|
||||
.FIXED_IO_ps_porb (FIXED_IO_ps_porb ),
|
||||
.FIXED_IO_ps_srstb (FIXED_IO_ps_srstb ),
|
||||
|
||||
.UART_rxd (uart_rx ),
|
||||
.UART_txd (uart_tx ),
|
||||
|
||||
.clk_axi (clk_axi ),
|
||||
.rstn_axi ( )
|
||||
);
|
||||
|
||||
|
||||
//--------------------------------led----------------------------------
|
||||
led led_breath(
|
||||
.clk (clk_axi ),
|
||||
.led (led_b )
|
||||
);
|
||||
|
||||
assign led1 = led_b;
|
||||
assign led2 = led_b;
|
||||
assign led3 = led_b;
|
||||
|
||||
endmodule
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
|
||||
<key id="BA" for="node" attr.name="base_addr" attr.type="string"/>
|
||||
<key id="BP" for="node" attr.name="base_param" attr.type="string"/>
|
||||
<key id="EH" for="edge" attr.name="edge_hid" attr.type="int"/>
|
||||
<key id="HA" for="node" attr.name="high_addr" attr.type="string"/>
|
||||
<key id="HP" for="node" attr.name="high_param" attr.type="string"/>
|
||||
<key id="LT" for="node" attr.name="lock_type" attr.type="string"/>
|
||||
<key id="MA" for="node" attr.name="master_addrspace" attr.type="string"/>
|
||||
<key id="MX" for="node" attr.name="master_instance" attr.type="string"/>
|
||||
<key id="MI" for="node" attr.name="master_interface" attr.type="string"/>
|
||||
<key id="MS" for="node" attr.name="master_segment" attr.type="string"/>
|
||||
<key id="MV" for="node" attr.name="master_vlnv" attr.type="string"/>
|
||||
<key id="TM" for="node" attr.name="memory_type" attr.type="string"/>
|
||||
<key id="SX" for="node" attr.name="slave_instance" attr.type="string"/>
|
||||
<key id="SI" for="node" attr.name="slave_interface" attr.type="string"/>
|
||||
<key id="MM" for="node" attr.name="slave_memmap" attr.type="string"/>
|
||||
<key id="SS" for="node" attr.name="slave_segment" attr.type="string"/>
|
||||
<key id="SV" for="node" attr.name="slave_vlnv" attr.type="string"/>
|
||||
<key id="TU" for="node" attr.name="usage_type" attr.type="string"/>
|
||||
<key id="VH" for="node" attr.name="vert_hid" attr.type="int"/>
|
||||
<key id="VM" for="node" attr.name="vert_name" attr.type="string"/>
|
||||
<key id="VT" for="node" attr.name="vert_type" attr.type="string"/>
|
||||
<graph id="G" edgedefault="undirected" parse.nodeids="canonical" parse.edgeids="canonical" parse.order="nodesfirst">
|
||||
<node id="n0">
|
||||
<data key="VM">design_1</data>
|
||||
<data key="VT">BC</data>
|
||||
</node>
|
||||
<node id="n1">
|
||||
<data key="VH">2</data>
|
||||
<data key="VM">design_1</data>
|
||||
<data key="VT">VR</data>
|
||||
</node>
|
||||
<node id="n2">
|
||||
<data key="TU">active</data>
|
||||
<data key="VH">2</data>
|
||||
<data key="VT">PM</data>
|
||||
</node>
|
||||
<edge id="e0" source="n0" target="n1"/>
|
||||
<edge id="e1" source="n1" target="n2"/>
|
||||
</graph>
|
||||
</graphml>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"ActiveEmotionalView":"Default View",
|
||||
"Default View_ScaleFactor":"1.25",
|
||||
"Default View_TopLeft":"-969,-462",
|
||||
"ExpandedHierarchyInLayout":"",
|
||||
"guistr":"# # String gsaved with Nlview 7.0r6 2020-01-29 bk=1.5227 VDI=41 GEI=36 GUI=JA:10.0 non-TLS
|
||||
# -string -flagsOSRD
|
||||
preplace port DDR -pg 1 -lvl 2 -x 330 -y 60 -defaultsOSRD
|
||||
preplace port FIXED_IO -pg 1 -lvl 2 -x 330 -y 80 -defaultsOSRD
|
||||
preplace port UART -pg 1 -lvl 2 -x 330 -y 100 -defaultsOSRD
|
||||
preplace port port-id_clk_axi -pg 1 -lvl 2 -x 330 -y 140 -defaultsOSRD
|
||||
preplace port port-id_rstn_axi -pg 1 -lvl 2 -x 330 -y 160 -defaultsOSRD
|
||||
preplace inst processing_system7_0 -pg 1 -lvl 1 -x 160 -y 110 -defaultsOSRD
|
||||
preplace netloc processing_system7_0_FCLK_CLK0 1 1 1 N 140
|
||||
preplace netloc processing_system7_0_FCLK_RESET0_N 1 1 1 N 160
|
||||
preplace netloc processing_system7_0_DDR 1 1 1 N 60
|
||||
preplace netloc processing_system7_0_FIXED_IO 1 1 1 N 80
|
||||
preplace netloc processing_system7_0_UART_0 1 1 1 N 100
|
||||
levelinfo -pg 1 0 160 330
|
||||
pagesize -pg 1 -db -bbox -sgen 0 0 450 220
|
||||
"
|
||||
}
|
||||
0
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"ActiveEmotionalView":"Default View",
|
||||
"Default View_ScaleFactor":"1.5",
|
||||
"Default View_TopLeft":"-831,-353",
|
||||
"ExpandedHierarchyInLayout":"",
|
||||
"guistr":"# # String gsaved with Nlview 7.0r6 2020-01-29 bk=1.5227 VDI=41 GEI=36 GUI=JA:10.0 non-TLS
|
||||
# -string -flagsOSRD
|
||||
preplace port M_AXI -pg 1 -lvl 2 -x 240 -y 70 -defaultsOSRD
|
||||
preplace port S_AXI -pg 1 -lvl 0 -x 0 -y 50 -defaultsOSRD
|
||||
preplace port port-id_M_ACLK -pg 1 -lvl 0 -x 0 -y 70 -defaultsOSRD
|
||||
preplace port port-id_M_ARESETN -pg 1 -lvl 0 -x 0 -y 90 -defaultsOSRD
|
||||
preplace port port-id_S_ACLK -pg 1 -lvl 0 -x 0 -y 20 -defaultsOSRD
|
||||
preplace port port-id_S_ARESETN -pg 1 -lvl 0 -x 0 -y 110 -defaultsOSRD
|
||||
preplace inst s01_data_fifo -pg 1 -lvl 1 -x 120 -y 70 -defaultsOSRD
|
||||
preplace netloc M_ACLK_1 1 0 1 NJ 70
|
||||
preplace netloc M_ARESETN_1 1 0 1 NJ 90
|
||||
preplace netloc s01_couplers_to_s01_data_fifo 1 0 1 NJ 50
|
||||
preplace netloc s01_data_fifo_to_s01_couplers 1 1 1 N 70
|
||||
levelinfo -pg 1 0 120 240
|
||||
pagesize -pg 1 -db -bbox -sgen -140 -10 340 150
|
||||
"
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
module led(
|
||||
input wire clk, // 输入时钟
|
||||
output reg led // led 输出(高电平有效)
|
||||
);
|
||||
|
||||
localparam MAX_DELAY_CNT = 1000000,
|
||||
CYCLE_NUMBER = 100; //占空比分为0~100个级别
|
||||
|
||||
reg myclk;
|
||||
reg [23:0] delay_cnt;
|
||||
reg [7:0] current_cycle;
|
||||
reg flag;
|
||||
reg [7:0] cycle;
|
||||
|
||||
//--------------------------------------------------------
|
||||
// myclk分频
|
||||
always@(posedge clk) begin
|
||||
if(delay_cnt < MAX_DELAY_CNT)
|
||||
delay_cnt <= delay_cnt + 1'b1;
|
||||
else begin
|
||||
delay_cnt <= 24'd1;
|
||||
myclk <= ~myclk;
|
||||
end
|
||||
end
|
||||
|
||||
//--------------------------------------------------------
|
||||
// 0的时候,占空比最小,这个时候直接完全输出高电平,led灯最亮
|
||||
// 100的时候,占空比最大,这个时候直接完全输出低电平,led等熄灭
|
||||
always@(posedge myclk) begin
|
||||
if(flag == 0) begin // 占空比递增
|
||||
if(current_cycle < (CYCLE_NUMBER/10))
|
||||
current_cycle <= current_cycle + 1'b1;
|
||||
else
|
||||
flag <= ~flag;
|
||||
end
|
||||
else begin // 占空比递减
|
||||
if(current_cycle > 0)
|
||||
current_cycle <= current_cycle - 1'b1;
|
||||
else
|
||||
flag <= ~flag;
|
||||
end
|
||||
end
|
||||
|
||||
//--------------------------------------------------------
|
||||
// 轮询 0~100个级别的占空比
|
||||
always@(posedge clk)
|
||||
if(cycle < CYCLE_NUMBER)
|
||||
cycle <= cycle + 1'b1;
|
||||
else
|
||||
cycle <= 1'b1;
|
||||
|
||||
//--------------------------------------------------------
|
||||
// cycle小于current_cycle的时候是低电平
|
||||
// cycle大于current_cycle并且小于CYCLE_NUMBER的时候是高电平
|
||||
always@(posedge clk)
|
||||
if((cycle == CYCLE_NUMBER) && (current_cycle != 0))
|
||||
led <= 1'b1;
|
||||
else if(cycle < current_cycle)
|
||||
led <= 1'b1;
|
||||
else
|
||||
led <= 1'b0;
|
||||
|
||||
endmodule
|
|
@ -0,0 +1,54 @@
|
|||
#KEY
|
||||
set_property PACKAGE_PIN G14 [get_ports key]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports key]
|
||||
|
||||
|
||||
#LED
|
||||
set_property PACKAGE_PIN H15 [get_ports led1]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports led1]
|
||||
|
||||
set_property PACKAGE_PIN G15 [get_ports led2]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports led2]
|
||||
|
||||
set_property PACKAGE_PIN N15 [get_ports led3]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports led3]
|
||||
|
||||
#UART
|
||||
set_property PACKAGE_PIN N20 [get_ports uart_tx]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports uart_tx]
|
||||
|
||||
set_property PACKAGE_PIN U20 [get_ports uart_rx]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports uart_rx]
|
||||
|
||||
#EEPROM
|
||||
set_property PACKAGE_PIN P16 [get_ports eeprom_scl]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports eeprom_scl]
|
||||
|
||||
set_property PACKAGE_PIN P15 [get_ports eeprom_sda]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports eeprom_sda]
|
||||
|
||||
|
||||
#GPIO
|
||||
set_property PACKAGE_PIN K19 [get_ports gpio1]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports gpio1]
|
||||
|
||||
set_property PACKAGE_PIN F20 [get_ports gpio2]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports gpio2]
|
||||
|
||||
set_property PACKAGE_PIN J18 [get_ports gpio3]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports gpio3]
|
||||
|
||||
set_property PACKAGE_PIN L20 [get_ports gpio4]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports gpio4]
|
||||
|
||||
set_property PACKAGE_PIN L17 [get_ports gpio5]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports gpio5]
|
||||
|
||||
set_property PACKAGE_PIN M17 [get_ports gpio6]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports gpio6]
|
||||
|
||||
set_property PACKAGE_PIN K18 [get_ports gpio7]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports gpio7]
|
||||
|
||||
set_property PACKAGE_PIN L16 [get_ports gpio8]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports gpio8]
|
|
@ -0,0 +1 @@
|
|||
set_property BITSTREAM.GENERAL.COMPRESS true [current_design]
|
|
@ -0,0 +1,18 @@
|
|||
from pyfpga.vivado import Vivado
|
||||
|
||||
prj = Vivado(odir=f'./build')
|
||||
|
||||
prj.set_part('xc7z010-2-clg400')
|
||||
prj.add_param('FREQ', '125000000')
|
||||
prj.add_cons('timing.xdc')
|
||||
prj.add_cons('pin.xdc')
|
||||
prj.add_param('SECS', '1')
|
||||
|
||||
prj.add_include('./')
|
||||
prj.add_vlog('*.v')
|
||||
prj.add_vlog('./design_1/design_1.bd')
|
||||
|
||||
prj.set_top('TOP')
|
||||
|
||||
# prj.make()
|
||||
prj.prog()
|
Loading…
Reference in New Issue