[HDLBits] Conditional

Given four unsigned numbers, find the minimum. Unsigned numbers can be compared with standard comparison operators (a < b). Use the conditional operator to make two-way min circuits, then compose a few of them to create a 4-way min circuit. You'll probably want some wire vectors for the intermediate results.

复制代码
module top_module (
    input [7:0] a, b, c, d,
    output [7:0] min);//
    wire [7:0] res1,res2;
	assign res1= a<b?a:b;
    assign res2= c<d?c:d;
    assign min=res1<res2?res1:res2;
    // assign intermediate_result1 = compare? true: false;

endmodule
相关推荐
FPGA小c鸡8 小时前
FPGA跨时钟域设计完全指南:从亚稳态到CDC同步器(附实战案例与代码)
fpga开发
FPGA小c鸡2 天前
异步FIFO设计与验证完全指南:从格雷码到CDC同步的深度解析(附SystemVerilog实战代码)
fpga开发
春风细雨无声2 天前
基于FPGA实现PAL视频接口(附代码)
图像处理·fpga开发·视频
算法笑匠2 天前
FPGA驱动AD9226实现65MSPS高速数据采集
fpga·adc·高速数据采集·ad9226
国科安芯2 天前
多相交错并联系统的时钟同步精度与输入纹波抵消效应研究
网络·单片机·嵌入式硬件·fpga开发·性能优化
科恒盛远3 天前
KH919-基于FPGA实现的线性调频卡
fpga开发
FPGA小c鸡4 天前
PCIe接口详解:从协议原理到FPGA实现的完整指南
fpga开发
良许Linux4 天前
FPGA原理和应用
stm32·单片机·fpga开发·程序员·嵌入式·编程
Hello.Reader4 天前
Flink External Resource Framework让作业“原生”申请 GPU/FPGA 等外部资源
大数据·fpga开发·flink
嵌入式-老费4 天前
Linux Camera驱动开发(fpga vs soc)
驱动开发·fpga开发