Simple one-hot state transition 3

The following is the state transition table for a Moore state machine with one input, one output, and four states. Use the following one-hot state encoding: A=4'b0001, B=4'b0010, C=4'b0100, D=4'b1000.

Derive state transition and output logic equations by inspection assuming a one-hot encoding. Implement only the state transition logic and output logic (the combinational logic portion) for this state machine. (The testbench will test with non-one hot inputs to make sure you're not trying to do something more complicated).

题目网站
a

module top_module(
    input in,
    input [3:0] state,
    output [3:0] next_state,
    output out); //

    parameter A=0, B=1, C=2, D=3;

    // State transition logic: Derive an equation for each state flip-flop.
    assign next_state[A] = ((state[A])&&(!in))||((state[C])&&(!in));
    assign next_state[B] = ((state[A])&&(in))||((state[B])&&(in))||((state[D])&&(in));
    assign next_state[C] = ((state[B])&&(!in))||((state[D])&&(!in));
    assign next_state[D] = ((state[C])&&(in));

    // Output logic: 
    assign out = (state[D])?1:0;

endmodule

这个题目中表示state是否是我们需要的状态的写法可以学学next_state[A]

posted @   江左子固  阅读(26)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
点击右上角即可分享
微信分享提示