Re: clock enable for fixed interval



Your approach is flawed. It will not work well because it is not in
line with the generally accepted way of FPGA programming. It uses
asynchronous logic, which is frowned upon because the tools don't
support it well. Insisting on using asynchronous logic will do you no
favor.

It's perfectly valid that you want a clock-enable. However, it's
unusual that you want the clock-enable to be centered "around the
clock edge". It probably stems from working with discrete chips, where
THAT was most reliable way to enable clocks.

In logic (discrete or FPGA), it's also possible to "enable" clocks by
adding the enable as extra logic input, plus feedback of the previous
output. Then you can "always clock" the register, yet make it only
accept (honor) the change when "enable" is active. From the logic
point of view, this is equivalent to a real clock-enable. But from
other points of view, like for example power consumption, it may not
be.

Yet it is good enough, and it helps achieving another goal: make a
whole design from nothing but synchronous logic! This has been a
major milestone in FPGA architecture. It's so much easier to do timing
analysis on purely synchronous designs. In fact, the current tools do
almost exclusively synchronous analysis ("static timing"). It was
easier to make designs synchronous, than to make the tools handle
asynchronous designs..

Using synchronous logic is very important for you. If you have any
timing problems with your design, then you've either not read the
timing report, or you've used non-synchronous tricks and are about to
regret them.

Your desire to enable clocks is very wide spread, and so the FPGA
makers have implemented support for their synchronous equivalent,
right in the hardware. The necessary extra logic input and the
feedback of the previous state is "free" in all modern (and not so
modern) FPGAs. There is dedicated circuitry just for this purpose.

The following code shows how to register something on every other
cycle. The tools will recognize it and use none of "your" resouces
for it.

process (clk)
begin
if rising_edge(clk) then
clkenable <= not(clkenable);
end if;
end process;

process (clk)
begin
if rising_edge(clk) then
if clkenable='1' then
reg_something <= combinatorial_something;
end if;
end if;
end process;

PS: There is another common desire for asynchronous logic in many
designs, specifically for RESET. Read about it in other threads on
this group or elsewhere. There's more opinion about it because doing
it wrong doesn't fail right away. Yet (in my opinion) you should also
go strictly synchronous because that's what the tools can handle.
.



Relevant Pages

  • Re: clock enable for fixed interval
    ... THAT was most reliable way to enable clocks. ... In logic (discrete or FPGA), it's also possible to "enable" clocks by ... analysis on purely synchronous designs. ... almost exclusively synchronous analysis ("static timing"). ...
    (comp.arch.fpga)
  • Re: Whats Your Favorite Processor on an FPGA?
    ... efficient in an FPGA. ... of addressing registers in order to access parameters of a stack CPU. ... Anyone else here doing processor designs on FPGAs? ... If you need Ethernet, then Ethernet is useful. ...
    (sci.electronics.design)
  • Re: Whats Your Favorite Processor on an FPGA?
    ... efficient in an FPGA. ... of addressing registers in order to access parameters of a stack CPU. ... Anyone else here doing processor designs on FPGAs? ... There's supposed to be a Cyclone coming soon, with dual-hard-core ARM processors ...
    (sci.electronics.design)
  • Re: simple SRAM memory controller on the Altera Nios Dev Kit (Cyclone ed)
    ... I didn't supply any timing constraints for the FPGA pins connected to the SRAM and I suspect that to be the problem, but I'm a bit unsure what should I give as constaints. ... Assuming the delay of getting my address to the SRAM is roughly equivalent to the delay getting the data back I should only have to worry about the tOH of the SRAM being large enough. ...
    (comp.arch.fpga)
  • Re: Regarding process time calculation
    ... (snip on timing of processors and FPGAs) ... execution time and its variability down various code paths, ... As you say, it's a very simialr problem, but the FPGA is much more ... arbitrarily high confidence of "meeting timing" is readily-available ...
    (comp.arch.fpga)