|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2010-3-29 22:47:54
|
显示全部楼层
module key(clk,rst,row,column,dataout,en);
input clk,rst;
input column,row;
output dataout;
output en;
reg[3:0] en=4'b0000;
//++++++++++++++++++++++++++++++++++++++
// 分频器 开始
//++++++++++++++++++++++++++++++++++++++
reg [15:0] cnt;
always@(posedge clk,negedge rst)
begin
if(!rst)
begin
duan<=0;
en<=0;
end
else begin
cnt<=cnt+1;
end
end
//++++++++++++++++++++++++++++++++++++++
// 扫描 开始
//++++++++++++++++++++++++++++++++++++++
wire cnt_flag=cnt[15];
reg[3:0] duan;//!!!!!!!!错?0028!!!!!!!/////
always@(cnt_flag)//!!!!!!错误10029!!!!!!!!/////
begin
case(row)
4'b 1110:
case(column)
4'b1110: duan<=0;
4'b1101: duan<=1;
4'b1011: duan<=2;
4'b0111: duan<=3;
default: duan<=0;
endcase
4'b 1101:
case(column)
4'b1110: duan<=4;
4'b1101: duan<=5;
4'b1011: duan<=6;
4'b0111: duan<=7;
default: duan<=0;
endcase
4'b 1011:
case(column)
4'b1110: duan<=8;
4'b1101: duan<=9;
4'b1011: duan<=10;
4'b0111: duan<=11;
default: duan<=0;
endcase
4'b 0111:
case(column)
4'b1110: duan<=12;
4'b1101: duan<=13;
4'b1011: duan<=14;
4'b0111: duan<=15;
default: duan<=0;
endcase
default: duan<=0;
endcase
end
//++++++++++++++++++++++++++++++++++++++
// 输出开始
//++++++++++++++++++++++++++++++++++++++
reg[7:0] dataout;
always@(duan)
begin
case(duan)
4'd0 :dataout<=8'h3f;
4'd1 :dataout<=8'h60;
4'd2 :dataout<=8'h5b;
4'd3 :dataout<=8'h4f;
4'd4 :dataout<=8'h66;
4'd5 :dataout<=8'h6d;
4'd6 :dataout<=8'hd6;
4'd7 :dataout<=8'h7;
4'd8 :dataout<=8'h7f;
4'd9 :dataout<=8'h6f;
4'd10 :dataout<=8'h77;
4'd11 :dataout<=8'h7c;
4'd12 :dataout<=8'h39;
4'd13 :dataout<=8'h5e;
4'd14 :dataout<=8'h79;
4'd15 :dataout<=8'h71;
default: dataout<=8'h3f;
endcase
end
endmodule
错误提示:Error (10028): Can't resolve multiple constant drivers for net "duan.1111" at key.v(29)
Error (10029): Constant driver at key.v(30)
Error: Can't elaborate top-level user hierarchy |
|