Read in EN

zero filling

VHDL/Verilog는 assign 문장에서 source와 destination의 width가 틀리면 error가 발생한다.

scode는 destination의 width가 source보다 큰 경우 자동으로 upper bits에 0을 채우는 기능이 있다.

가령 b가 4bits logic, a가 1 bit logic으로 정의되어 있는 경우 a를 b에다 할당하는 code가 있다고 하자.

logic(a)
logic(b[4])

b <= a

위의 code는 zero filling을 수행한 후 아래와 같이 변환된다.

b <= "000" & a;

만일 반대로 a에다 b를 assign하는 경우 error가 발생한다.

a <= b

Width of destination[1] and source[4] should be same

Destination은 1bits인데, source가 4bits라는 error이다.

← All posts