Read in EN

active high

HDL를 작성할 때는 active high 또는 active low를 이용하는데, scode는 active high를 default로 이용한다. 마찬가지로 clock edge는 rising edge를 default로 사용한다.

아래의 예는 clock rising에 맞추어 data를 counting하는 예이다. reset이 high인 경우 data는 0이 된다.

sequence(clk)
    data <= (0, reset==1, data + 1)  

sequence(clk)
    data <= (0, reset, data + 1) # 위의 예와 동일하지만 expression이 아닌
    logic을 기술해도 active high로 자동 인식한다.

And/Or를 사용할 때도 1 bit logic인 경우 굳이 expression을 사용하지 않아도 되는 장점이 있다.

o1 <= (i1, And(a==1, b==1), i2)
o1 <= (i1, a & b, i2)  # 위의 예보다는 간편하게 표현할 수 있다.

다만 FPGA chip외부의 신호들은 active low 신호가 존재하는데 이 경우 처음 input에서 바로 polarity를 바꾸거나 FPGA 출력 직전에 polarity를 변경하면 좋다. 다시 말해 top module의 io에서 polarity를 외부 신호에 맞추어 변경하고, 나머지 module에서는 active high를 사용하는 것이 좋다.

reset <= ~reset_n  : active low로 들어온 신호를 not gate로 변경한 후 active high인 reset를 사용하면 된다. 

out_en_n <= ~out_en : active high인 enable 신호를 마지막에 polarity를
변경하면 된다. 
← All posts