This is only a start:
1) You have to add an SDC file with create_clock like this
create_clock -name Clk -period 3.333 [get_ports {Clk}]
so that you inform Quartus that you want 300 MHz. You will get fmax 144 MHz with Cyclone IV (I have not Quartus subscription so changed target device)
2) In Analysis & Synthesis Settings:
- set Speed into Optimization Technique
- enable Perform WYSIWYG primitive resynthesis
3) In Physical Synthesis Optimizations set effort to Extra and Check all options under Optimize for performance
With also 2) and 3) you will get fmax 180 MHz
4) Add a PLL to compensate clock (so in Normal Mode)
Wrap all with a file like this (or simply add PLL in your TOP)
LIBRARY ieee;
USE ieee.std_logic_1164.all;
LIBRARY work;
ENTITY IPG1_FIP_worker IS
PORT
(
Reset : IN STD_LOGIC;
In_Start_In : IN STD_LOGIC;
In_DE_In : IN STD_LOGIC;
inclk0 : IN STD_LOGIC;
In_Data_In : IN STD_LOGIC_VECTOR(35 DOWNTO 0);
Setting_B_In : IN STD_LOGIC_VECTOR(11 DOWNTO 0);
Setting_Disables_In : IN STD_LOGIC_VECTOR(2 DOWNTO 0);
Setting_Field_In : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
Setting_G_In : IN STD_LOGIC_VECTOR(11 DOWNTO 0);
Setting_Line_In : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
Setting_Pattern_In : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
Setting_Pixel_In : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
Setting_R_In : IN STD_LOGIC_VECTOR(11 DOWNTO 0);
Setting_TotLine_In : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
Setting_TotPixel_In : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
Out_Start_Out : OUT STD_LOGIC;
Out_DE_Out : OUT STD_LOGIC;
Out_Data_Out : OUT STD_LOGIC_VECTOR(35 DOWNTO 0)
);
END IPG1_FIP_worker;
ARCHITECTURE bdf_type OF IPG1_FIP_worker IS
COMPONENT top
GENERIC (BurstLength : INTEGER;
Intended_compiler : STRING;
Intended_device_family : STRING;
IPG1_Max_combine_nr : INTEGER
);
PORT(Clk : IN STD_LOGIC;
Reset : IN STD_LOGIC;
In_Start_In : IN STD_LOGIC;
In_DE_In : IN STD_LOGIC;
In_Data_In : IN STD_LOGIC_VECTOR(35 DOWNTO 0);
Setting_B_In : IN STD_LOGIC_VECTOR(11 DOWNTO 0);
Setting_Disables_In : IN STD_LOGIC_VECTOR(2 DOWNTO 0);
Setting_Field_In : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
Setting_G_In : IN STD_LOGIC_VECTOR(11 DOWNTO 0);
Setting_Line_In : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
Setting_Pattern_In : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
Setting_Pixel_In : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
Setting_R_In : IN STD_LOGIC_VECTOR(11 DOWNTO 0);
Setting_TotLine_In : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
Setting_TotPixel_In : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
Out_Start_Out : OUT STD_LOGIC;
Out_DE_Out : OUT STD_LOGIC;
Out_Data_Out : OUT STD_LOGIC_VECTOR(35 DOWNTO 0)
);
END COMPONENT;
COMPONENT pll
PORT(inclk0 : IN STD_LOGIC;
c0 : OUT STD_LOGIC
);
END COMPONENT;
SIGNAL SYNTHESIZED_WIRE_0 : STD_LOGIC;
BEGIN
b2v_inst : top
GENERIC MAP(BurstLength => 64,
Intended_compiler => "Default",
Intended_device_family => "Default",
IPG1_Max_combine_nr => 8
)
PORT MAP(Clk => SYNTHESIZED_WIRE_0,
Reset => Reset,
In_Start_In => In_Start_In,
In_DE_In => In_DE_In,
In_Data_In => In_Data_In,
Setting_B_In => Setting_B_In,
Setting_Disables_In => Setting_Disables_In,
Setting_Field_In => Setting_Field_In,
Setting_G_In => Setting_G_In,
Setting_Line_In => Setting_Line_In,
Setting_Pattern_In => Setting_Pattern_In,
Setting_Pixel_In => Setting_Pixel_In,
Setting_R_In => Setting_R_In,
Setting_TotLine_In => Setting_TotLine_In,
Setting_TotPixel_In => Setting_TotPixel_In,
Out_Start_Out => Out_Start_Out,
Out_DE_Out => Out_DE_Out,
Out_Data_Out => Out_Data_Out);
b2v_inst1 : pll
PORT MAP(inclk0 => inclk0,
c0 => SYNTHESIZED_WIRE_0);
END bdf_type;
Note: You should use PLL compatible with your device, maybe ALTPLL is not compatible with Arria V5. You should also add PLL with Megawizard Plugin Manger to your project.
I recommend you to use 50 MHz oscillator onboard and multiply it with PLL to 300 MHz. So SDC became:
derive_clock_uncertainty
derive_pll_clocks
create_clock -name inclk0 -period 20.0
Now fmax (always on Cyclone IV but on Arria V will be better) will be 183 MHz. Slightly better but helps with timings of a lot of paths.
5) Run Timequest and start Report Timing Closure Recommendations, you will see that to improve you have to add pipeline (= Flip-Flop) between some paths..
Hottest path is from top:b2v_inst|testpattern_Setting_TotPixel[5] to top:b2v_inst|IPG1_FIP_worker_testpattern:i_testpattern|HelperGrayBar[1]_OTERM23, you have Adder and LessThan operator in same clock cycle, check in your code what is wrong and try to split it into 2 clock cycles and repeat 5)