Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generate Interrupt

Status
Not open for further replies.

YodaTheGreat

Programmer
Jun 2, 2004
6
FR
hi all,

I like generate a Interrupt (output) in VDHL
------| |-----
|_|

an interrupt of 500ns to 1us (no problem)
(I have a Clock in my design)

I have in my design

if VarL>=X"3FC0" Then
-- Here I want generate a Interrupt
-- may be by one another signal or other method.
End if;


best Regards Yodathegreat
 
Ok. So you need to ask some questions first.

1. It seems that you want an interrupt that is at least 500ns but no more than 1 us. is that true?

2. So how many of your clock cycles is that?

3. Do you only want to generate an interrupt when you see VarL going greater than 3FC0, or all the time WHILE VarL is greater than 3FC0. (maybe VarL gets cleared by the interrupt handler which causes the interrupt to go away?)

4. how quickly does your interrupt need to occur after the event is true, is that an issue?



one possible solution is:

process (clk, reset)
begin
if reset = '1' then
start_int <= '0';
int <= '0';
int_cnt <= 0;
-- rising edge even of clock.
elsif clk'event and clk = '1' then

if VarL >= X"3FC0" then
start_int <= '1';
else
start_int <= '0';
end if;

last_start_int <= start_int;

-- check for new interrupt
if start_int = '1' and last_start_int = '0' then
int_cnt <= 1;
elsif int_cnt = 50 then -- or some other count
int_cnt <= 0;
elsif int_cnt /= 0 then
int_cnt <= int_cnt + 1;
end if;

if int_cnt /= 0 then
int <= '1';
else
int <= '0';
end if;
end if;
end process;


but of course that may not be exactly what you want. However if you modify it based on the questions I asked you can probably get a result that you require.

Post your answers to the questions, and your resulting code and I will let you know if you got it right.

--
 
Hi VHDLguy,

no I want one shoot, my "if VarL>=X"3FC0" Then"
is in a "case Status_r"
when Attente3EME =>
if X >= X"3FC0" then
--- Generate Interrupt
Status_r :=Attente2EME;
End If;

If you have a idea....

best regards Yodathegreat


 
what I wrote should be roughtly what you want. just remove the

if VarL >= X"3FC0" then
start_int <= '1';
else
start_int <= '0';
end if;

and add the start_int <= '1' in your case statement.
You should also add the start_int <= '0' in the other cases so that it clears, otherwise you will only ever get one interrupt.

--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top