1. 문제 및 설명
- 4개의 Unsigned 숫자가 주어졌을 때, 최소값을 구하라. Unsigned 숫자는 표준 비교 연산자(<,>)사용할 수 있다.
2. 모듈 정의
module top_module (
input [7:0] a, b, c, d,
output [7:0] min);
3. 답
module top_module (
input [7:0] a, b, c, d,
output [7:0] min);//
// assign intermediate_result1 = compare? true: false;
assign min = (a<b)?((a<c)?((a<d)?a:d):((c<d)?c:d)):((b<c)?((b<d)?b:d):((c<d)?c:d));
endmodule
공감
'Verilog > HDLbits' 카테고리의 다른 글
| [HDLBits] Gates100 (0) | 2025.12.07 |
|---|---|
| [HDLBits] Reduction (0) | 2025.12.07 |
| [HDLBits] Always nolatches (1) | 2025.12.07 |
| [HDLBits] Always casez (0) | 2025.12.07 |
| [HDLBits] Always case2 (0) | 2025.11.24 |