题解 | #序列发生器#

序列发生器

https://www.nowcoder.com/practice/1fe78a981bd640edb35b91d467341061

`timescale 1ns/1ns

module sequence_generator(
	input clk,
	input rst_n,
	output reg data
	);
	reg [5:0] ref;
	always @ (posedge clk or negedge rst_n)
		if (!rst_n)
			ref <= 6'b001011;
		else
			ref <= {ref[4:0],ref[5]};
	always @ (posedge clk or negedge rst_n)
		if (!rst_n)
			data <= 0;
		else
			data <= ref[5];
						
endmodule

全部评论

相关推荐

1 收藏 评论
分享
牛客网
牛客企业服务