Skip to content

Commit b4c6697

Browse files
committed
Added Fmax test project for Gowin
1 parent f2ed272 commit b4c6697

File tree

17 files changed

+882
-0
lines changed

17 files changed

+882
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#------------------------------------------------------------------------------
2+
# .gitignore for Gowin IDE
3+
# Konstantin Pavlov, pavlovconst@gmail.com
4+
#------------------------------------------------------------------------------
5+
6+
# INFO ------------------------------------------------------------------------
7+
# rename the file to ".gitignore" and place into your Gowin project directory
8+
#
9+
10+
11+
# junk files
12+
*.gprj.user
13+
impl/gwsynthesis/*.html
14+
impl/gwsynthesis/*.xml
15+
impl/gwsynthesis/*.log
16+
impl/gwsynthesis/*.vg
17+
18+
# junk directories
19+
/impl/pnr
20+
/impl/temp
21+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
@echo off
2+
rem ------------------------------------------------------------------------------
3+
rem clean_gowin.bat
4+
rem published as part of https://github.com/pConst/basic_verilog
5+
rem Konstantin Pavlov, pavlovconst@gmail.com
6+
rem ------------------------------------------------------------------------------
7+
8+
rem Use this file as a boilerplate for your custom clean script
9+
rem for Gowin IDE projects
10+
11+
12+
rem preserving .\impl\gwsynthesis\test.prj file
13+
del /s /f /q .\impl\gwsynthesis\*.html
14+
del /s /f /q .\impl\gwsynthesis\*.xml
15+
del /s /f /q .\impl\gwsynthesis\*.log
16+
del /s /f /q .\impl\gwsynthesis\*.vg
17+
18+
del /s /f /q .\impl\pnr\*
19+
rmdir /s /q .\impl\pnr\
20+
21+
del /s /f /q .\impl\temp\*
22+
rmdir /s /q .\impl\temp\
23+
24+
del /s /f /q .*.gprj.user
25+
26+
pause
27+
goto :eof
28+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE gowin-synthesis-project>
3+
<Project>
4+
<Version>beta</Version>
5+
<Device id="GW1NR-9C" package="QFN88P" speed="6" partNumber="GW1NR-LV9QN88PC6/I5"/>
6+
<FileList>
7+
<File path="J:\basic_verilog\example_projects\gowin_fmax_test_prj_template_v1\ip\sys_pll\sys_pll.v" type="verilog"/>
8+
<File path="J:\basic_verilog\example_projects\gowin_fmax_test_prj_template_v1\src\clk_divider.sv" type="verilog"/>
9+
<File path="J:\basic_verilog\example_projects\gowin_fmax_test_prj_template_v1\src\delay.sv" type="verilog"/>
10+
<File path="J:\basic_verilog\example_projects\gowin_fmax_test_prj_template_v1\src\edge_detect.sv" type="verilog"/>
11+
<File path="J:\basic_verilog\example_projects\gowin_fmax_test_prj_template_v1\src\main.sv" type="verilog"/>
12+
</FileList>
13+
<OptionList>
14+
<Option type="disable_insert_pad" value="0"/>
15+
<Option type="dsp_balance" value="0"/>
16+
<Option type="looplimit" value="2000"/>
17+
<Option type="output_file" value="J:\basic_verilog\example_projects\gowin_fmax_test_prj_template_v1\impl\gwsynthesis\test.vg"/>
18+
<Option type="print_all_synthesis_warning" value="0"/>
19+
<Option type="ram_rw_check" value="1"/>
20+
<Option type="verilog_language" value="sysv-2017"/>
21+
<Option type="vhdl_language" value="vhdl-1993"/>
22+
</OptionList>
23+
</Project>
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
"Allow_Duplicate_Modules" : false,
3+
"Annotated_Properties_for_Analyst" : true,
4+
"BACKGROUND_PROGRAMMING" : "off",
5+
"COMPRESS" : false,
6+
"CRC_CHECK" : true,
7+
"Clock_Conversion" : true,
8+
"DONE" : false,
9+
"DOWNLOAD_SPEED" : "default",
10+
"Default_Enum_Encoding" : "default",
11+
"Disable_Insert_Pad" : false,
12+
"ENCRYPTION_KEY" : false,
13+
"ENCRYPTION_KEY_TEXT" : "00000000000000000000000000000000",
14+
"FORMAT" : "binary",
15+
"FSM Compiler" : true,
16+
"Fanout_Guide" : 10000,
17+
"Frequency" : "Auto",
18+
"Generate_Constraint_File_of_Ports" : false,
19+
"Generate_IBIS_File" : false,
20+
"Generate_Plain_Text_Timing_Report" : false,
21+
"Generate_Post_PNR_Simulation_Model_File" : false,
22+
"Generate_Post_Place_File" : false,
23+
"Generate_SDF_File" : false,
24+
"GwSyn_Loop_Limit" : 2000,
25+
"HOTBOOT" : false,
26+
"I2C" : false,
27+
"I2C_SLAVE_ADDR" : "00",
28+
"Implicit_Initial_Value_Support" : false,
29+
"IncludePath" : [
30+
31+
],
32+
"Incremental_Compile" : "",
33+
"Initialize_Primitives" : false,
34+
"JTAG" : false,
35+
"MODE_IO" : false,
36+
"MSPI" : false,
37+
"Multiple_File_Compilation_Unit" : true,
38+
"Number_of_Critical_Paths" : "",
39+
"Number_of_Start/End_Points" : "",
40+
"OUTPUT_BASE_NAME" : "test",
41+
"POWER_ON_RESET" : false,
42+
"PRINT_BSRAM_VALUE" : true,
43+
"PROGRAM_DONE_BYPASS" : false,
44+
"Pipelining" : true,
45+
"PlaceInRegToIob" : true,
46+
"PlaceIoRegToIob" : true,
47+
"PlaceOutRegToIob" : true,
48+
"Place_Option" : "0",
49+
"Process_Configuration_Verion" : "1.0",
50+
"Promote_Physical_Constraint_Warning_to_Error" : true,
51+
"Push_Tristates" : true,
52+
"READY" : false,
53+
"RECONFIG_N" : false,
54+
"Ram_RW_Check" : true,
55+
"Report_Auto-Placed_Io_Information" : false,
56+
"Resolve_Mixed_Drivers" : false,
57+
"Resource_Sharing" : true,
58+
"Retiming" : false,
59+
"Route_Option" : "0",
60+
"Run_Timing_Driven" : true,
61+
"SECURE_MODE" : false,
62+
"SECURITY_BIT" : true,
63+
"SPI_FLASH_ADDR" : "00000000",
64+
"SSPI" : false,
65+
"Show_All_Warnings" : false,
66+
"Synthesis On/Off Implemented as Translate On/Off" : false,
67+
"Synthesize_tool" : "GowinSyn",
68+
"TopModule" : "",
69+
"USERCODE" : "default",
70+
"Unused_Pin" : "As_input_tri_stated_with_pull_up",
71+
"Update_Compile_Point_Timing_Data" : false,
72+
"Use_Clock_Period_for_Unconstrainted IO" : false,
73+
"Use_SCF" : false,
74+
"VHDL_Standard" : "VHDL_Std_1993",
75+
"Verilog_Standard" : "Vlg_Std_Sysv2017",
76+
"WAKE_UP" : "0",
77+
"Write_Vendor_Constraint_File" : true,
78+
"dsp_balance" : false,
79+
"show_all_warnings" : false
80+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[General]
2+
ipc_version=4
3+
file=sys_pll
4+
module=sys_pll
5+
target_device=gw1nr9c-004
6+
type=clock_rpll
7+
version=1.0
8+
9+
[Config]
10+
CKLOUTD3=false
11+
CLKFB_SOURCE=0
12+
CLKIN_FREQ=27
13+
CLKOUTD=false
14+
CLKOUTP=false
15+
CLKOUT_BYPASS=false
16+
CLKOUT_DIVIDE_DYN=true
17+
CLKOUT_FREQ=250
18+
CLKOUT_TOLERANCE=3
19+
DYNAMIC=false
20+
LANG=0
21+
LOCK_EN=true
22+
MODE_GENERAL=true
23+
PLL_PWD=false
24+
RESET_PLL=false
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
-series GW1NR
2+
-device GW1NR-9C
3+
-package QFN88P
4+
-part_number GW1NR-LV9QN88PC6/I5
5+
6+
7+
-mod_name sys_pll
8+
-file_name sys_pll
9+
-path J:/fpga_tests/fifo_single_clock_reg_v2_test_gw/ip/sys_pll/
10+
-type PLL
11+
-rPll true
12+
-file_type vlg
13+
-dev_type GW1NR-9C
14+
-dyn_idiv_sel false
15+
-idiv_sel 4
16+
-dyn_fbdiv_sel false
17+
-fbdiv_sel 37
18+
-dyn_odiv_sel false
19+
-odiv_sel 2
20+
-dyn_da_en false
21+
-rst_sig false
22+
-rst_sig_p false
23+
-fclkin 27
24+
-clkfb_sel 0
25+
-en_lock true
26+
-clkout_bypass false
27+
-en_clkoutp false
28+
-clkoutp_bypass false
29+
-en_clkoutd false
30+
-clkoutd_bypass false
31+
-en_clkoutd3 false
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
//Copyright (C)2014-2022 Gowin Semiconductor Corporation.
2+
//All rights reserved.
3+
//File Title: IP file
4+
//GOWIN Version: V1.9.8.05
5+
//Part Number: GW1NR-LV9QN88PC6/I5
6+
//Device: GW1NR-9C
7+
//Created Time: Sun May 15 09:43:06 2022
8+
9+
module sys_pll (clkout, lock, clkin);
10+
11+
output clkout;
12+
output lock;
13+
input clkin;
14+
15+
wire clkoutp_o;
16+
wire clkoutd_o;
17+
wire clkoutd3_o;
18+
wire gw_gnd;
19+
20+
assign gw_gnd = 1'b0;
21+
22+
rPLL rpll_inst (
23+
.CLKOUT(clkout),
24+
.LOCK(lock),
25+
.CLKOUTP(clkoutp_o),
26+
.CLKOUTD(clkoutd_o),
27+
.CLKOUTD3(clkoutd3_o),
28+
.RESET(gw_gnd),
29+
.RESET_P(gw_gnd),
30+
.CLKIN(clkin),
31+
.CLKFB(gw_gnd),
32+
.FBDSEL({gw_gnd,gw_gnd,gw_gnd,gw_gnd,gw_gnd,gw_gnd}),
33+
.IDSEL({gw_gnd,gw_gnd,gw_gnd,gw_gnd,gw_gnd,gw_gnd}),
34+
.ODSEL({gw_gnd,gw_gnd,gw_gnd,gw_gnd,gw_gnd,gw_gnd}),
35+
.PSDA({gw_gnd,gw_gnd,gw_gnd,gw_gnd}),
36+
.DUTYDA({gw_gnd,gw_gnd,gw_gnd,gw_gnd}),
37+
.FDLY({gw_gnd,gw_gnd,gw_gnd,gw_gnd})
38+
);
39+
40+
defparam rpll_inst.FCLKIN = "27";
41+
defparam rpll_inst.DYN_IDIV_SEL = "false";
42+
defparam rpll_inst.IDIV_SEL = 3;
43+
defparam rpll_inst.DYN_FBDIV_SEL = "false";
44+
defparam rpll_inst.FBDIV_SEL = 36;
45+
defparam rpll_inst.DYN_ODIV_SEL = "false";
46+
defparam rpll_inst.ODIV_SEL = 2;
47+
defparam rpll_inst.PSDA_SEL = "0000";
48+
defparam rpll_inst.DYN_DA_EN = "false";
49+
defparam rpll_inst.DUTYDA_SEL = "1000";
50+
defparam rpll_inst.CLKOUT_FT_DIR = 1'b1;
51+
defparam rpll_inst.CLKOUTP_FT_DIR = 1'b1;
52+
defparam rpll_inst.CLKOUT_DLY_STEP = 0;
53+
defparam rpll_inst.CLKOUTP_DLY_STEP = 0;
54+
defparam rpll_inst.CLKFB_SEL = "internal";
55+
defparam rpll_inst.CLKOUT_BYPASS = "false";
56+
defparam rpll_inst.CLKOUTP_BYPASS = "false";
57+
defparam rpll_inst.CLKOUTD_BYPASS = "false";
58+
defparam rpll_inst.DYN_SDIV_SEL = 2;
59+
defparam rpll_inst.CLKOUTD_SRC = "CLKOUT";
60+
defparam rpll_inst.CLKOUTD3_SRC = "CLKOUT";
61+
defparam rpll_inst.DEVICE = "GW1NR-9C";
62+
63+
endmodule //sys_pll
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//Copyright (C)2014-2022 Gowin Semiconductor Corporation.
2+
//All rights reserved.
3+
//File Title: Template file for instantiation
4+
//GOWIN Version: V1.9.8.05
5+
//Part Number: GW1NR-LV9QN88PC6/I5
6+
//Device: GW1NR-9C
7+
//Created Time: Sun May 15 09:43:06 2022
8+
9+
//Change the instance name and port connections to the signal names
10+
//--------Copy here to design--------
11+
12+
sys_pll your_instance_name(
13+
.clkout(clkout_o), //output clkout
14+
.lock(lock_o), //output lock
15+
.clkin(clkin_i) //input clkin
16+
);
17+
18+
//--------Copy end-------------------
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//------------------------------------------------------------------------------
2+
// clk_divider.sv
3+
// published as part of https://github.com/pConst/basic_verilog
4+
// Konstantin Pavlov, pavlovconst@gmail.com
5+
//------------------------------------------------------------------------------
6+
7+
// INFO ------------------------------------------------------------------------
8+
// Divides main clock to get derivative slower synchronous clocks
9+
//
10+
11+
/* --- INSTANTIATION TEMPLATE BEGIN ---
12+
13+
clk_divider #(
14+
.WIDTH( 32 )
15+
) CD1 (
16+
.clk( clk ),
17+
.nrst( 1'b1 ),
18+
.ena( 1'b1 ),
19+
.out( )
20+
);
21+
22+
--- INSTANTIATION TEMPLATE END ---*/
23+
24+
25+
module clk_divider #( parameter
26+
WIDTH = 32
27+
)(
28+
input clk,
29+
input nrst,
30+
input ena,
31+
output logic [(WIDTH-1):0] out = '0
32+
);
33+
34+
35+
always_ff @(posedge clk) begin
36+
if ( ~nrst ) begin
37+
out[(WIDTH-1):0] <= '0;
38+
end else if (ena) begin
39+
out[(WIDTH-1):0] <= out[(WIDTH-1):0] + 1'b1;
40+
end
41+
end
42+
43+
endmodule
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//------------------------------------------------------------------------------
2+
// clogb2.svh
3+
// published as part of https://github.com/pConst/basic_verilog
4+
// Konstantin Pavlov, pavlovconst@gmail.com
5+
//------------------------------------------------------------------------------
6+
7+
// INFO ------------------------------------------------------------------------
8+
// Calculates counter/address width based on specified vector/RAM depth
9+
//
10+
// Function should be instantiated inside a module
11+
// But you are free to call it from anywhere by its hierarchical name
12+
//
13+
// To add clogb2 function to your module:
14+
// `include "clogb2.svh"
15+
//
16+
17+
function integer clogb2;
18+
input integer depth;
19+
20+
for( clogb2=0; depth>0; clogb2=clogb2+1 ) begin
21+
depth = depth >> 1;
22+
end
23+
endfunction
24+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//------------------------------------------------------------------------------
2+
// Gowin test project template
3+
// published as part of https://github.com/pConst/basic_verilog
4+
// Konstantin Pavlov, pavlovconst@gmail.com
5+
//------------------------------------------------------------------------------
6+
7+
8+
// Vivado bugfix ===============================================================
9+
10+
// This is a workaround for Vivado bug of not providing errors
11+
// when using undeclared signals in your code
12+
// See https://forums.xilinx.com/t5/Synthesis/Bug-in-handling-undeclared-signals-in-instance-statement-named/td-p/300127
13+
//`define VIVADO_MODULE_HEADER `default_nettype none
14+
//`define VIVADO_MODULE_FOOTER `default_nettype wire
15+
16+
// Declare these stubs to safely reuse your Vivado modules in non-Xilinx FPGA projects
17+
`define VIVADO_MODULE_HEADER
18+
`define VIVADO_MODULE_FOOTER
19+
20+
// =============================================================================
21+
22+
`define INC( AVAL ) \
23+
``AVAL <= ``AVAL + 1'b1;
24+
25+
`define DEC( AVAL ) \
26+
``AVAL <= ``AVAL - 1'b1;
27+
28+
`define SET( AVAL ) \
29+
``AVAL <= 1'b1;
30+
31+
`define RESET( AVAL ) \
32+
``AVAL <= 1'b0;

0 commit comments

Comments
 (0)