OR Gate Modeling
OR 게이트 모델링
OR Gate - Behavioral Model (Using \(\texttt{wait}\) Statement )
-- Entity Declaration
ENTITY OR2 IS
PORT (I1, I2 : IN bit;
O : OUT bit );
END OR2;
-- Architecture Body
ARCHITECTURE Behavioral OF OR2 IS
BEGIN
PROCESS
BEGIN
if ( (I1='0') and (I2='0') ) then
O <= '0' after 2 ns;
else O <= '1' after 2 ns;
end if
wait on I1, I2;
END PROCESS
END Behavioral;
- 2ns만큼의 Delay가 지난 뒤에 전달되는 Signal이기 때문에 등호(\(\texttt{:=}\))와 구별되어 사용된다.
- \(\texttt{wait}\)문에 의해, Signal \(\texttt{I1}\) 혹은 \(\texttt{I2}\)에 값이 바뀌면 \(\texttt{PROCESS}\)문의 처음으로 가서 다시 수행한다.
- \(\texttt{wait}\)문은 Event가 발생하면 회로가 동작하게 설정하는 구문이다.
- \(\texttt{wait}\)문 대신, \(\texttt{PROCESS}\)문 옆의 소괄호를 이용하여 Sensitivity List*로 구현해도 결과는 동일하다.
* Sensitivity Signal List
- \(\texttt{wait}\)문 대신, \(\texttt{PROCESS}\) 키워드 바로 뒤 괄호 안에 Sensitivity Signal List를 명시하여,
Signal \(\texttt{I1}\) 혹은 \(\texttt{I2}\)에 변화가 있을 때, \(\texttt{PROCESS}\)문을 처음부터 다시 수행시킬 수 있다.
PROCESS (I1, I2) -- Sensitivity Signal List
BEGIN
if ( (I1='0') and (I2='0') ) then
O <= '0' after 2 ns;
else O <= '1' after 2 ns;
end if
END PROCESS
OR Gate - Dataflow Model
-- Entity Declaration
ENTITY OR2 IS
PORT ( I1, I2 : IN bit;
O : OUT bit );
END OR2;
-- Architecture Body
ARCHITECTURE Dataflow OF OR2 IS
BEGIN
0 <= I1 or I2 after 2 ns;
END Dataflow;
※ OR2 Gate는 세부적 Component가 없는 단일 회로이므로, Structural Modeling이 불가능하다.