题解 | #256选1选择器#

256选1选择器

https://www.nowcoder.com/practice/a0b6ee521e534826b44fbf5e24cd4aa0

`timescale 1ns/1ns

module top_module (
	input [255:0] in,
	input [7:0] sel,
	output  out
);
	// genvar i = 0;
	// generate
	// 	always @(posedge in,sel)begin
	// 		case(sel)
	// 			i:out = in[i];
	// 			default:out = 0;
	// 		endcase
	// 	end
	// endgenerate
	//想多了
	assign out = in[sel];
endmodule

全部评论
用循环的话,case里面的out得用一个reg型换掉吧
1 回复 分享
发布于 2023-06-06 17:30 江苏
我第一遍写的跟你一模一样哈哈哈
点赞 回复 分享
发布于 2023-05-25 16:49 江苏

相关推荐

05-23 19:02
吉林大学 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务