Verilog practice

这篇博客主要介绍了Verilog编程中的一些实践问题,包括如何生成特定波形的代码,设计Moore状态机来处理输入延迟,实现Mealy型状态机检测10110序列,以及利用Mealy机检测最后3个样本中存在多个1的情况。此外,还讨论了如何设计分频器,如将时钟频率分为3/2和40的倍数。
摘要由CSDN通过智能技术生成

Q1: write Verilog code to generate below waveform: 

Q2: write Verilog code to generate below waveform:

Since there is one delay after the rising edge of data in, three delays after the negedge of din, I write a moore FSM.

module delay_reg(rst,clk,d_in,d_out);
input rst,clk, d_in;
output reg d_out;
reg [1:0] c_s, n_s;
parameter s0=2'b00, s1=2'b01,s2=2'b10,s3=2'b11;

always @(posedge clk)begin
 if(rst)	
     c_s<=s0;
  else
		c_s<= n_s;end
always@(*)begin
	case(c_s)
		s0: begin 
			if(d_in)
			n_s=s1;
			else
			n_s
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值