惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
The Cloudflare Blog
WordPress大学
WordPress大学
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 司徒正美
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
J
Java Code Geeks
云风的 BLOG
云风的 BLOG
C
Check Point Blog
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss
V
V2EX
F
Fortinet All Blogs
B
Blog
大猫的无限游戏
大猫的无限游戏
N
Netflix TechBlog - Medium
B
Blog RSS Feed
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

博客园 - yf.x

超声波测距#倒车雷达#DE10-Lite 按键计数器#DE10-Lite 按键消抖#DE10-Lite 流水呼吸灯v2#DE10-Lite 流水呼吸灯-v1#DE10-Lite 呼吸灯-#DE10-Lite 流水灯#DE10-Lite#Verilog HDLBits_review 2015fsm 补码FSM-HDLbits 串行数据接收判断-HDLbits 输出PS2数据流-HDLbits PS2数据流检测状态机-HDLbits 独热码状态机-HDLbits 旅鼠4-HDLbits 旅鼠游戏3-HDLbits 旅鼠游戏2-HDLbits 旅鼠游戏--HDLbits 水库水位控制问题-HDLbits 康威生命游戏-hdlbits
串行数据流输出其中的数据位-HDLbits
yf.x · 2025-12-19 · via 博客园 - yf.x

把检测到成功收到的串行数据流中的8位数据位输出。

module top_module(
input clk,
input in,
input reset, // Synchronous reset
output [7:0] out_byte,
output done
); //
reg [9:0]data_in;
parameter IDLE=0,START=1,BIT0=2,BIT1=3,BIT2=4,BIT3=5,BIT4=6,
BIT5=7,BIT6=8,BIT7=9,STOP=10,ERROR=11;
reg[3:0]state,next_state;
// Use FSM from Fsm_serial
always @(*)
case(state)
IDLE:next_state=in?IDLE:START;
START:next_state=BIT0;
BIT0:next_state=BIT1;
BIT1:next_state=BIT2;
BIT2:next_state=BIT3;
BIT3:next_state=BIT4;
BIT4:next_state=BIT5;
BIT5:next_state=BIT6;
BIT6:next_state=BIT7;
BIT7:next_state=in?STOP:ERROR;
STOP:next_state=in?IDLE:START;
ERROR:next_state=in?IDLE:ERROR;
default:next_state=IDLE;
endcase

always @(posedge clk)
if(reset)
state<=IDLE;
else
state<=next_state;
assign done=state==STOP;

// New: Datapath to latch input bits.
always @(posedge clk)
if(reset)
data_in<=10'h0;
else
data_in<={in,data_in[9:1]};

assign out_byte=(state==STOP)?data_in[8:1]:10'hx;
endmodule