打印

modelsim仿真时st1和1有什么区别

[复制链接]
7979|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
andiwxz|  楼主 | 2012-7-31 15:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
各位好:
     我写了个串口的发送模块。仿真遇到一些问题求解答。
     1,数据的value值有的显示1、0,有的显示st1、st0.有什么区别?
     2,case执行不正确。rxd_state 我reset后应该是0,但是value值是1.1就1吧,但是执行case(rxd_state) 却跑到R_IDLE 下面。R_IDLE 是0啊。R_IDLE 下边还有个rxd_state = R_SAMPLE; 因为值一直是1,所以也不知道真执行没有,只不过下次进来还是跑到
R_IDLE 下面 。请教为什么,下边是程序
//receive data
parameter
R_IDLE
=
1'b0;
//>=7 clk_smp : receive flag
parameter
R_SAMPLE
=
1'b1;
//sample data programmer
parameter   tx_err = 2'b01;
reg
rxd_state;
reg
[2:0]
len_cnt;
//the lenth of data
reg   [7:0] rxd_data;
reg  [7:0]  rxd_cnt;
always@(posedge clk or negedge rst_n)
begin

if(!rst_n)

begin

len_cnt <= 0;

rxd_data <= 0;

rxd_state <= R_IDLE;

wr<=0;

end

else if(clk_bps == 1)

begin

case(rxd_state)

R_IDLE:

begin

len_cnt <= 0;

if(neg_io_in == 1'b0)

begin

rxd_state = R_SAMPLE;

end

end

R_SAMPLE:


begin

len_cnt <= len_cnt +1'b1;

if(len_cnt == 4'd8)

begin

rxd_state = R_IDLE;

//rx_time_cnt<=0;

end

case(len_cnt)

4'd0:
rxd_data[0] <= neg_io_in;

4'd1:
rxd_data[1] <= neg_io_in;

4'd2:
rxd_data[2] <= neg_io_in;

4'd3:
rxd_data[3] <= neg_io_in;

4'd4:
rxd_data[4] <= neg_io_in;

4'd5:
rxd_data[5] <= neg_io_in;

4'd6:
rxd_data[6] <= neg_io_in;

4'd7:
rxd_data[7] <= neg_io_in;

4'd7:
rxd_data[8] <= neg_io_in;

endcase



end

endcase

end
end
3,程序assign neg_io_in = io_in3 & io_in2 & ~io_in1 & ~io_in;
     不管io_in3、io_in2、io_in1、io_in0值是多少,neg_io_in的value值永远是st0.请教为什么?

相关帖子

沙发
andiwxz|  楼主 | 2012-7-31 15:44 | 只看该作者
贴出的程序格式不怎么好,重新发一下
parameter        R_IDLE                =        1'b0;                //>=7 clk_smp : receive flag
parameter        R_SAMPLE        =        1'b1;                //sample data programmer
parameter   tx_err = 2'b01;
reg                        rxd_state;
reg        [2:0]        len_cnt;                                        //the lenth of data
reg   [7:0] rxd_data;
reg  [7:0]  rxd_cnt;
always@(posedge clk or negedge rst_n)
begin
        if(!rst_n)
                begin
                len_cnt <= 0;
                rxd_data <= 0;
                rxd_state <= R_IDLE;
                wr<=0;
                end
        else if(clk_bps == 1)
                begin
                case(rxd_state)
                R_IDLE:
                        begin
                        len_cnt <= 0;
                        if(neg_io_in == 1'b0)
                                begin
                                rxd_state = R_SAMPLE;
                                end
                        end
                R_SAMPLE:       
                        begin
                        len_cnt <= len_cnt +1'b1;
                        if(len_cnt == 4'd8)
                                begin
                                rxd_state = R_IDLE;
                                //rx_time_cnt<=0;
                                end
                        case(len_cnt)
                        4'd0:        rxd_data[0] <= neg_io_in;
                        4'd1:        rxd_data[1] <= neg_io_in;
                        4'd2:        rxd_data[2] <= neg_io_in;
                        4'd3:        rxd_data[3] <= neg_io_in;
                        4'd4:        rxd_data[4] <= neg_io_in;
                        4'd5:        rxd_data[5] <= neg_io_in;
                        4'd6:        rxd_data[6] <= neg_io_in;
                        4'd7:        rxd_data[7] <= neg_io_in;
                        4'd7:        rxd_data[8] <= neg_io_in;
                        endcase                       
                        end
                endcase
                end
end

使用特权

评论回复
板凳
kdurant| | 2012-8-1 12:17 | 只看该作者
st1,st0是对单个端口显示的
1,0是对总线显示的
我貌似观察是这样的

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

166

主题

258

帖子

3

粉丝