你的程序一看就有错误啊! reg [7:0] cnt = 0;这样赋初值是错误的. reg cntout;应为上面一样. 还有最后一个else cnt = 0; cntout = cnt; 应加begin-end语句. 正确的应是: module ramuse( cntout, mclk, dinen); output [7:0] cntout; input mclk, dinen; reg[7:0] cntout; reg [7:0] cnt; always @(posedge mclk ) begin if(dinen == 1) begin if(cnt<=9) cnt=cnt+1; else cnt=0; end else begin cnt = 0; cntout = cnt; end end //assign cntout = cnt; endmodule 功能不知对不对,下次帮你看看! |