3.1.2 Combinational Logic - Multiplexers

Kiwoong Nam·2025년 6월 6일

HDLBits

목록 보기
6/11

기말고사 범위는 매우 간단한 회로가 다수 포함되어 있어 돌아볼 만한 문제만 작성했다.

256-to-1 4-bit multiplexer

Mux256to1v

module top_module( 
    input [1023:0] in,
    input [7:0] sel,
    output [3:0] out );
    assign out = in[sel*4 +: 4];
    assign out = in[sel*4+3 -: 4];
    assign out = {in[sel*4+3], in[sel*4+2], in[sel*4+1], in[sel*4+0]};

endmodule

Concatenation으로 해결할 수도 있지만, indexed vector part select로 해결할 수도 있다. +=는 LSB에서 MSB 방향으로, -=는 MSB에서 LSB 방향으로, 왼쪽의 시작 인덱스를 포함하여 오른쪽의 길이만큼 원소를 선택한다.

0개의 댓글