dy1985 发表于 2013-4-12 14:20:28

求助~~~

//`timescale 1 ns / 1 ps
        module keyled
        (   key,clk,rst,
          led
        );
        input key,clk,rst;
        output led;
        reg led;
        //------------------------------------------
        reg count;
        always @ (posedge clk, negedge rst)
        if(!rst)
        count <= 0;
        else
        count <= count+1'b1;
        //-------------------------------------------

        reg keycnt;
        always @ (posedge clk, negedge rst)
        if(!rst)
                keycnt <= 8'd0;
        else
                keycnt <= keycnt + 1'b1;
        //-------------------------------------------
        reg bufdata1,bufdata2;
        always @ (posedge clk, negedge rst)
        if(!rst)
                bufdata1 <= 1;
        else
                if(keycnt == 20'hfffff)
                bufdata1 <= key;
        //-------------------------------------------
        always @ (posedge clk, negedge rst)
        if(!rst)
        bufdata2 <= 1;
        else
        bufdata2 <= bufdata1;
        //-------------------------------------------
        wire keyvalue;
        assign keyvalue = bufdata2 & (~bufdata1);
       
        reg keyjudge;
        always @ (posedge clk, negedge rst)
        if(!rst)
                keyjudge = 3'b0;
        else
                if(keyvalue)
                        if(keyjudge == 3'b100)
                                keyjudge = 3'b0;
                        else
                                keyjudge = keyjudge + 1'b1;
        //-------------------------------------------       

        always @ (posedge clk, negedge rst)
        if(!rst)
        begin
                led = count;
        end
        else
                begin
                case(keyjudge)
                        2'b0:        led = count;
                        2'b1:        led = count;
                        2'b10:        led = count;
                        2'b11:        led = count;
                        default:        led = 1'bx;
                endcase
          end
        endmodule

dy1985 发表于 2013-4-12 14:21:47

警告是:
Warning: Presettable and clearable registers converted to equivalent circuits with latches. Registers power-up to an undefined state, and DEVCLRn places the registers in an undefined state.
        Warning (13310): Register "led~reg0" is converted into an equivalent circuit using register "led~reg0_emulated" and latch "led~reg0latch"


请问问题 出在了哪?
请高手赐教

流氓马 发表于 2013-4-12 14:25:09

default:      led = 1'bx;
x 没识别吧

dy1985 发表于 2013-4-12 16:38:06

大虾们 都睡着了???{:sleepy:}

dianzimingong 发表于 2013-4-12 16:55:47

友情提示:小心ID   

食肉动物 发表于 2013-4-12 17:18:53

咦,lz的ID还在呢?等待消失。。。。

Soul.art 发表于 2013-4-12 17:42:23

这是虾米玩意啊,闪人

i_kkyu 发表于 2013-4-12 18:53:48

友情提示:小心ID   
+1

tastier 发表于 2013-4-13 14:32:02

i_kkyu 发表于 2013-4-12 18:53 static/image/common/back.gif
友情提示:小心ID   
+1

他ID怎么了。。。。

tianxian 发表于 2013-4-13 14:32:50

标题不规范

i_kkyu 发表于 2013-4-13 14:48:21

tastier 发表于 2013-4-13 14:32 static/image/common/back.gif
他ID怎么了。。。。

标题不合格,如果有人举报的话。。会被封ID的。
页: [1]
查看完整版本: 求助~~~