如题,synthesis时是可以正常通过的但是implementa tion就直接闪退了,没有出错提示,完全不知道该往哪个方向修改,求大神指点。
以下是代码,实现的功能是用串口接收数据,作为计数初值,再用计数器计数到零并在数码管上显示计数值,计数结束后led灯灭。
工程文件超过2M,受限没法上传,抱歉了。
顶层代码:
- module uart_top(
- input clk,
- input reset,
- output [6:0]seg7,
- output [3:0]an,
- input rxd,
- output led
- );
-
-
-
- reg [7:0]delaysec;
- wire RxClk;//接收时钟为波特率9600的16倍
- wire RxDone;
- wire [7:0]RevData;
- wire [7:0]countnum1;
-
-
- defparam U0.divdFACTOR=5208,U0.divdWIDTH=13;//分频出9600的波特率
- gen_divd U0(
- .reset(reset),
- .clkin(clk),
- .clkout(TxClk)
- );
-
-
- defparam U6.divdFACTOR=325,U6.divdWIDTH=9;//波特率9600的16倍
- gen_divd2 U6(
- .reset(reset),
- .clkin(clk),
- .clkout(RxClk)
- );
-
- rxd_ip U7(
- .clk(RxClk),
- .reset(reset),
- .rxd(rxd),
- .rxdready(RxDone),
- .rxddata(RevData)
- );
-
- counter100 countrev(
- .clk(RxClk),
- .totalcount(delaysec),
- .reset(reset),
- .led(led),
- .rxdone(RxDone),
- .countnum(countnum1)
- );
-
- displaycount disp(.count(countnum1),.reset(reset),.seg(seg7),.an(an),.clk(clk));
-
- always@(posedge RxClk or negedge reset)
- begin
- if(!reset)delaysec<=0;
- else
- begin
- delaysec<=RevData-8'd48;
- end
- end
-
- endmodule
复制代码
底层
- module counter100(
- input clk,
- input [7:0]totalcount,
- input reset,
- input rxdone,
- output led,
- output reg [7:0]countnum
- );
-
- parameter load=2'b01;
- parameter change=2'b11;
-
- reg [26:0]count1s=0;
- wire count1s_en;
- parameter div1s=9600;
- reg [1:0]state;
-
-
- always@(posedge clk or negedge reset)
- begin
- if(!reset)
- count1s<=27'b0;
- else
- begin
- if(count1s==div1s)
- begin
- count1s<=27'b0;
- end
- else
- count1s<=count1s+1'b1;
- end
- end
-
- assign count1s_en=count1s==0;
-
- always@(posedge clk or negedge reset)
- begin
- if(!reset)
- begin
- countnum<=8'd0;
- state<=load;
- end
- else
- case(state)
- load:
- begin
- if(rxdone==1)
- begin
- state<=change;
- countnum<=totalcount;
- end
- else state<=load;
- end
-
- change:
- begin
- if(count1s_en)
- begin
- if(countnum==0)
- begin
- countnum<=1'b0;
- state<=load;
- end
- else
- begin
- countnum<=countnum-1'b1;
- state<=change;
- end
- end
- end
- default:state<=load;
- endcase
- end
-
- assign led=~(countnum==1'b0);
-
- endmodule
复制代码
1
已退回2积分
|
1个回答
|
|
|