简体   繁体   English

在 VHDL 中使用 fpga 进行中断处理

[英]Interrupt handling with fpga in VHDL

I am writing interputs for a fpga and dsp need to interact with a dual port memory shared dpram control in vhdl.我正在为 fpga 编写输入,dsp 需要与 vhdl 中的双端口内存共享 dpram 控件进行交互。 I have External IOs coming from the SPI bus on oneside to the fpag to be communicated with dsp and on the otherhand have a camera to the to the dsp.我有外部 IO 从一侧的 SPI 总线到要与 dsp 通信的 fpag,另一方面有一个摄像头连接到 dsp。 So my intrups are like Havinf a FIFO being reset after everytime a FSM reads and writes the interrpts with dsp.因此,我的中断就像 Havinf,每次 FSM 使用 dsp 读取和写入中断后都会重置 FIFO。

Now my problem is现在我的问题是

  1. I want to enable some particular interupts at a time and disable the others.我想一次启用一些特定的中断并禁用其他中断。
  2. When make a masking with logical XOR function the other interupts coming from UART goes for a timeout.当使用逻辑异或函数进行屏蔽时,来自 UART 的其他中断会超时。
  3. When this is done the camera gets the signal but cant be controlled.完成此操作后,相机会收到信号但无法控制。

I use the following algorithm to deal with all asynchron inputs:我使用以下算法来处理所有异步输入:

  1. In event2reg_array_proc: save all inputs to parallel buffers “fifo_data_input_array”, each input(flag) should be put into separate buffer.在 event2reg_array_proc: 将所有输入保存到并行缓冲区“fifo_data_input_array”中,每个输入(标志)应放入单独的缓冲区。
  2. In reg_array2fifo_proc2: read each buffer serially and save them in a fifo “fifo320x32”.在 reg_array2fifo_proc2 中:串行读取每个缓冲区并将它们保存在一个 fifo“fifo320x32”中。
  3. In main FSM read the output from fifo and do the suitable processing, each cycle read out only one value, it should be one flag.在主 FSM 中读取 fifo 的输出并做适当的处理,每个周期只读取一个值,应该是一个标志。

If you get some flags which remains in register even after processing, the reason can be:如果您得到一些即使在处理后仍保留在寄存器中的标志,原因可能是:

  1. In event2reg_array_proc: and reg_array2fifo_proc2:, if one flag (in buffer) has been written in the fifo, it should be cleared from the buffer.在 event2reg_array_proc: 和 reg_array2fifo_proc2: 中,如果一个标志(在缓冲区中)已写入 fifo,则应将其从缓冲区中清除。 I use the “fifo_cnt” to control this.我使用“fifo_cnt”来控制它。 You can use simulation to check.您可以使用模拟来检查。
  2. Line Camera sends the FRAME_VALID signal as same as the LINE_VALID signal, so you can get a lot of CAM2DSP_FRAME_SYNC_FLAG with Line Camera. Line Camera 发送 FRAME_VALID 信号和 LINE_VALID 信号一样,所以你可以用 Line Camera 得到很多 CAM2DSP_FRAME_SYNC_FLAG。

So can any one suggest any algorithm to enable particular interupts while the the camera is still communicating with DSP.因此,任何人都可以提出任何算法来在相机仍在与 DSP 通信时启用特定的中断。

Your question is not clearly worded enough to enable a proper answer.您的问题措辞不够明确,无法给出正确答案。 But one point is clear : XOR is not a good choice for an interrupt mask!但有一点很清楚:XOR 不是中断掩码的好选择! Either AND or OR would be a better choice depending on the logic of the interrupt handler.根据中断处理程序的逻辑,AND 或 OR 将是更好的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM