Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to achieve our required frequency with the code

Not open for further replies.


Newbie level 4
Sep 6, 2010
Reaction score
Trophy points
Activity points
Hi this is Mangulal Nenavath, i have designed a 32 bit counter in VHDL.In my application the counter should work atleast at 250Mhz,but the counter which i have designed is working maximum at 147Mhz.So how to debbug this issue,can any one help me out.
I have contacted Actel technical support they told that with this coding style it is not possible to achieve that(250Mhz) frequency,try for some other coding style. Here the VHDL code for counter.

library IEEE;
entity cntr_33 is
Port ( clk,trig,reset : in STD_LOGIC;
reg_out : out STD_LOGIC_VECTOR (31 downto 0));
end cntr_33;
architecture Behavioral of cntr_33 is
constant start_value : STD_LOGIC_VECTOR (31 downto 0):=x"00989680";
constant stop_value : STD_LOGIC_VECTOR (31 downto 0):=x"3fffce8f";
constant step_size : STD_LOGIC_VECTOR (31 downto 0):=x"00ff3170";
signal reg_variable : STD_LOGIC_VECTOR (31 downto 0):=x"00000000";


if reset='1' then


elsif trig='1' then


elsif( clk'event and clk='1') and reg_variable<stop_value then

reg_variable<= reg_variable+step_size;

end if;
end process;


end behavioral;

they told that with this coding style it is not possible to achieve that(250Mhz) frequency,try for some other coding style.
That sounds reasonable for a brief answer. Primarly, it's not a problem of coding style rather than FPGA hardware synthesis. You have to understand the available performance of your FPGA family and find a design structure, that can achieve your specification. With simple designs, you don't think about. You write a HDL code and the design compiler does it's work. If you're getting to the speed limits, this doesn't work any more.

The design is basically an accumulator and adder with a fixed increment. The first point would be to find out the achievable speed of the basic 32 Bit adder and accumulator or "counter" for your FPGA family. This can be still done with a behavioral description. It may be the case, that the basic counter is already too fast, then it can be possibly pipelined. Pipelining however changes the behaviour of your component, so you have to modify the instantiating code as well.

If the basic counter works at 250 MHz, then the additional logic involved with start_value and stop_value is probably making it fail. The asynchronous set by the trigger input is at least bad considered, it must be even expected to prevent a reliable operation of the design. Either trig is unrelated to clk, then setup and hold conditions aren't met and start_value won't be set correctly. Or it's related, then it should be replaced by a synchronous preset.

The compare and optional count stop involved with stop_value can be pipelined too, but it's also affecting the "external appearance" of the design.

If you know, how the hardware structure should look like, you can either implement it in HDL or structural code. In a structural style design, it's probably more straightforward, to use blocks from the vendor library e.g. for counter with preset instead of writing behavioral code.
Not open for further replies.

Part and Inventory Search

Welcome to