代码编织梦想

假设使用以下单热编码,则通过检查推导出下一状态逻辑方程和输出逻辑方程:(S, S1, S11, S110, B0, B1, B2, B3, Count, Wait) = (10'b0000000001, 10'b0000000010, 10'b0000000100, ... , 10'b1000000000

模块声明

module top_module(
    input d,
    input done_counting,
    input ack,
    input [9:0] state,    // 10-bit one-hot current state
    output B3_next,   //这里的输出是指下一个状态是B3 后面同
    output S_next,
    output S1_next,
    output Count_next,
    output Wait_next,
    output done,
    output counting,
    output shift_ena
);

解决方案:

module top_module(
    input d,
    input done_counting,
    input ack,
    input [9:0] state,    // 10-bit one-hot current state
    output B3_next,
    output S_next,
    output S1_next,
    output Count_next,
    output Wait_next,
    output done,
    output counting,
    output shift_ena
); //
    parameter S=0, S1=1, S11=2, S110=3, B0=4, B1=5, B2=6, B3=7, Count=8, Wait=9;
   
    assign B3_next = state[B2];
    assign S_next = (state[Wait]&ack)|(state[S110]&~d)|(state[S1]&~d)|(state[S]&~d);
    assign S1_next = state[S]&d;
    assign Count_next = state[B3]|(state[Count]&~done_counting);
    assign Wait_next = (state[Count]&done_counting)|(state[Wait]&~ack);
    assign done = state[Wait];
    assign counting = state[Count];
    assign shift_ena = state[B0]|state[B1]|state[B2]|state[B3];
    
endmodule

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_44830822/article/details/130836954