Guest
I am trying to use Altera 9000 part to run at 16.66MHz clock...
I had several counters..and I have something close to this
signal counter: integer range 0 to 4194303;
process (clk,reset)
if (CLK='1' and CLK'event) then
count <= count + 1;
end if;
if (count <= 120 ) then
PW <= '0' ;
else if (count <= 178) then
PW <= '1';
else if (count <= 183) then
PW <= '0';
end if;
if (count <= 48000 ) then
PW_2 <= '1' ;
else if (count <= 48825) then
PW_2 <= '0';
else if (count <= 4182300) then
PW_2 <= '1';
end if;
end if;
end process;
I have a counter defined as integer range. and my code complies and
simulates.
What I noticed is that the counter was violating the setup and hold
time (gettting timing error and counter won't reset to 0) in Max Plus 2
simulation as well on the board, since I have a high integer value. So
I divided the clock by 2 and use 8.33MHz clock but now I can't get the
1020ns resolution for PW. (1020/120 = 8.5) so I need to go back to
16.67MHz clock (one of the PW is 1020ns active low)
I looked at somet Max Plus 2 primitives for counter but not sure how to
use them or is there a better way to define counter in Max Plus 2?? Any
tips?? Also, I didn't have any luck using Hex Value or Std_logic_vector
(coundn't do arithmetics in Max Plus 2 with Std_logic_vector)..does any
one know about this as well?
Thanks,
Martin
I had several counters..and I have something close to this
signal counter: integer range 0 to 4194303;
process (clk,reset)
if (CLK='1' and CLK'event) then
count <= count + 1;
end if;
if (count <= 120 ) then
PW <= '0' ;
else if (count <= 178) then
PW <= '1';
else if (count <= 183) then
PW <= '0';
end if;
if (count <= 48000 ) then
PW_2 <= '1' ;
else if (count <= 48825) then
PW_2 <= '0';
else if (count <= 4182300) then
PW_2 <= '1';
end if;
end if;
end process;
I have a counter defined as integer range. and my code complies and
simulates.
What I noticed is that the counter was violating the setup and hold
time (gettting timing error and counter won't reset to 0) in Max Plus 2
simulation as well on the board, since I have a high integer value. So
I divided the clock by 2 and use 8.33MHz clock but now I can't get the
1020ns resolution for PW. (1020/120 = 8.5) so I need to go back to
16.67MHz clock (one of the PW is 1020ns active low)
I looked at somet Max Plus 2 primitives for counter but not sure how to
use them or is there a better way to define counter in Max Plus 2?? Any
tips?? Also, I didn't have any luck using Hex Value or Std_logic_vector
(coundn't do arithmetics in Max Plus 2 with Std_logic_vector)..does any
one know about this as well?
Thanks,
Martin