- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone !
I'm working on a project where I generate a timestamp through a counter that is incremented by 1 every clock cycle. The thing is, every time I load the timestamp value in my buffer, the value is not incremented by 1 but by the size of my timestamp, which is 8 bits. So I will have my first value at 0 and then the second value at 7 the third one at 15 and so on .... I need to increment my counter no every clock cycle, but every 8 clock cycles, in order to solve the problem. So i would like to know if such a thing is possible, and if so, how could I do it ? I've tried to do it with a loop or with some wait statement, but so far nothing worked. Here is the code of my counter : LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY counter IS PORT( clk_i : in std_logic; count : out std_logic_vector(7 DOWNTO 0) ) ; end counter; ARCHITECTURE rtl OF counter IS SIGNAL s_count : STD_LOGIC_VECTOR(7 DOWNTO 0); begin process (clk_i) begin if clk_i'event AND clk_i = '1' then s_count <= s_count + 1; end if; end process; count <= s_count; end; Hoping some of you can help ! Thanks in advance. Cordially, David.Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
your s_count is 32 bits. Your count is 8 bits. How did it compile?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you I changed It, my mistake.
It's 32 bits on the board, but I put 8 bits in simulation in order to simplify the results- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do you read the counter as timestamp. You may not catchup with its speed. Normally people read timestamp from system clock.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well my counter will be the timestamp of my system. It could have been a clock as well.
Then I'll write it in the firsts pixels of my image. I have a 16MHz clock, and my video is at 30 frames per second. At that rate I have more timestamps than I have new images, avoiding the problem of having the same timestamp for several images. My micro-processor will pick a timestamp every time an image is refreshing. The thing is my timestamp is serialized to be send on my slave board and then parallelized to be treated. I need to increment my counter no every clock cycle, but every 8 clock cycles, in order to solve some parts of the problem.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page