Altera_Forum
Honored Contributor
10 years agoTimings - am I overthinking this?
I'm just learning VHDL & FPGAs (as a hobby). I studied electronic engineering at degree level over 20 years ago, but we didn't do anything with FPGAs then (they were still a bit 'leading edge'). Back then electronics were slower, and we worked with discrete logic (74LS) a lot. Timing was important (things like RAM had multi-ns setup/hold times and hundreds of ns access time)
I'm using a Cyclone II (DE1 board) and I want to have some internal memory. I can create the internal memory fine. Looking at examples, I can use a process and do something like: process(clk) begin if (rising_edge(clk)) then RAM_Addr <= myaddr; RAM_Clk <= '1'; end if; end process; And that will work (for setting the read address - obviously I need to do more to get the data out). So, I have a 2 clock cycle (1) set address, clock high, (2) read data, clock low, (1) set address, etc But, if I look at the datasheet for the Cyclone II, on page 5-17, it says that I need 35ps setup time for the address before the clock. From my understanding of VHDL, that's not what I've designed - I've designed that the address & clock change simultaneously. I know 35ps is not a lot of time, but it's not 0ps. Now, it seems to work OK - but is that (a) because the synthesis tools know about the timing requirements and sort it out, (b) I'm lucky, (c) something else? I could add an extra clock cycle into the reading algorithm, so it does (1) set address, (2) set clock high, (3) read data, clock low, (1) set address etc, but that'll complicate things and slow it down unnecessarily if it's not needed. (In the 'old' days, I may have added an otherwise-unneeded buffer or gate to delay the clock by 7ns or so without having to add extra states). Am I overthinking (and overcomplicating) it? Or should I be adding the extra steps in to be safe?