这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » FPGA » 触发信号的接收问题,求解答

共5条 1/1 1 跳转至

触发信号的接收问题,求解答

菜鸟
2016-09-07 10:03:27     打赏

各位前辈,我有一个verilog代码,是实现在触发信号triggle_rising(检测triggle的上升沿)有效的时候,FPGA控制adc工作然后采集完1000个数据的时候,把数据存储在RAM中,然后通过RAM把数据传到另一块板子。但现在问题是下到板子上就“触发信号triggle_rising”FGPA检测不到,不知道问题出在那了,希望前辈帮我看看这个程序,看有什么地方需要改进的,指点一下,这是我写的代码,在FSM状态机的部分:

module fsm(
  output [1:0] rw,
  //output triggle_rising,
  input spi_cs,
  input full,
  input triggle,
  input clk
    );
 
reg[1:0] state,next_state;
parameter S0 = 2'b00,
          S1 = 2'b01,
S2 = 2'b10,
S3 = 2'b11;
reg sync_cs1;
reg sync_cs2;

reg sync_triggle1;
reg sync_triggle2;
reg triggle_low;
reg triggle_high;
wire triggle_rising;
//reg triggle_rising = 0;

reg [1:0] rwR;
assign triggle_rising = (triggle_low) && (!triggle_high);

assign rw = rwR;
always @(posedge clk)
begin
  sync_cs1 <= spi_cs;
  sync_cs2 <= sync_cs1;
  sync_triggle1 <= triggle;
  sync_triggle2 <= sync_triggle1;
  triggle_low <= sync_triggle2;
  triggle_high <= triggle_low;
 // triggle_rising <= (triggle_low) && (!triggle_high);
end

always @(posedge clk)
begin
    state <= next_state;
end

always @(state,full,sync_cs2,triggle_rising)
  begin
    rwR = 2'b00;
    next_state = S0;
    case(state)
       S0 : begin
          if(triggle_rising) 
             next_state = S1;
     end
   S1 : begin
          rwR = 2'b01;
    if(full) 
       next_state = S2;
    else 
       next_state = S1;
    end
   S2 : begin
          next_state = S2;
          if(sync_cs2)
       next_state = S3;
  end
   S3 : begin
          rwR = 2'b10;
    if(full) 
      next_state = S0;
    else 
      next_state = S3;
  end
    endcase 
 end

endmodule





关键词: triggle     state     接收     解答    

菜鸟
2016-09-07 10:13:50     打赏
2楼
希望前辈能够指点一下,急急急!!!

菜鸟
2016-09-07 12:05:06     打赏
3楼
现在是检测上升沿 始终FPGA检测不到

菜鸟
2016-09-07 15:09:30     打赏
4楼
希望前辈给指点一下

菜鸟
2016-09-07 15:11:11     打赏
5楼
麻烦了,这个问题是在我把triggle_rising信号去掉,直接在程序中给其一个高电平,则能有数据出来,加上之后就一直是‘1’,没有数据出来,希望前辈们给指点一二,谢谢!

共5条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]