module jianyidianziqin(a,cout,clk,clr);
input [7:0]a;
input clk,clr;
output cout;
reg cout;
reg [7:0]b;
reg [7:0]f;
always@(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]) //8个按键
if(a[0]) cout<=f[0];
else
if(a[1]) cout<=f[1];
else
if(a[2]) cout<=f[2];
else
if(a[3]) cout<=f[3];
else
if(a[4]) cout<=f[4];
else
if(a[5]) cout<=f[5];
else
if(a[6]) cout<=f[6];
else
if(a[7]) cout<=f[7];
always@(posedge clk or negedge clr) //第1个音阶频率524hz
if(~clr) //清零
begin
b[0]<=1;
f[0]<=0;
end
else
begin
if(b[0]==47709)
begin
b[0]<=1;
f[0]<=~f[0];
end
else b[0]<=b[0]+1;
end
always@(posedge clk or negedge clr) //第2个音阶频率588hz
if(~clr)
begin
b[1]<=1;
f[1]<=0;
end
else
begin
if(b[1]==42517)
begin
b[1]<=1;
f[1]<=~f[1];
end
else b[1]<=b[1]+1;
end
always@(posedge clk or negedge clr) //第3个音阶频率660hz
if(~clr)
begin
b[2]<=1;
f[2]<=0;
end
else
begin
if(b[2]==37879)
begin
b[2]<=1;
f[2]<=~f[2];
end
else b[2]<=b[2]+1;
end
always@(posedge clk or negedge clr) //第4个音阶频率698hz
if(~clr)
begin
b[3]<=1;
f[3]<=0;
end
else
begin
if(b[3]==35817)
begin
b[3]<=1;
f[3]<=~f[3];
end
else b[3]<=b[3]+1;
end
always@(posedge clk or negedge clr) //第5个音阶频率784hz
if(~clr)
begin
b[4]<=1;
f[4]<=0;
end
else
begin
if(b[4]==31888)
begin
b[4]<=1;
f[4]<=~f[4];
end
else b[4]<=b[4]+1;
end
always@(posedge clk or negedge clr) //第6个音阶频率880hz
if(~clr)
begin
b[5]<=1;
f[5]<=0;
end
else
begin
if(b[5]==28409)
begin
b[5]<=1;
f[5]<=~f[5];
end
else b[5]<=b[5]+1;
end
always@(posedge clk or negedge clr) //第7个音阶频率988hz
if(~clr)
begin
b[6]<=1;
f[6]<=0;
end
else
begin
if(b[6]==25304)
begin
b[6]<=1;
f[6]<=~f[6];
end
else b[6]<=b[6]+1;
end
always@(posedge clk or negedge clr) //第8个音阶频率1046hz
if(~clr)
begin
b[7]<=1;
f[7]<=0;
end
else
begin
if(b[7]==23901)
begin
b[7]<=1;
f[7]<=~f[7];
end
else b[7]<=b[7]+1;
end
endmodule
这个代码为什么不行?