1. Ä«¿îÅÍ-vhdlÄÚµå
in STD_LOGIC; count out STD_LOGIC_VECTOR(3 downto 0));end binary_counter; architecture Behavioral of binary_counter issignal count_reg STD_LOGIC_VECTOR(3 downto 0) = `0000`;beginprocess(clk, reset)beginif reset = `1` thencount_reg `= `0000`; Reset the counter to 0elsif rising_edge(clk) thencount_reg `= count_reg + 1; Increment the counterend if;end process; count `= count_reg; Output the current count valueend Behavioral;``` À§ Äڵ忡¼ `entity` ºÎºÐÀº Ä«¿îÅÍÀÇ Æ÷Æ®¸¦ Á¤ÀÇÇÑ´Ù. `clk` ½ÅÈ£´Â Ä«¿îÅÍÀÇ Å¬·° ÀÔ·ÂÀ̸ç, `reset` ½ÅÈ£´Â Ä«¿îÅ͸¦ ÃʱâÈÇÏ´Â ¿ªÇÒÀ» ÇÑ´Ù. `count`´Â Ä«¿îÅÍÀÇ ÇöÀç °ªÀ» Ãâ·ÂÇÏ´Â Æ÷Æ®ÀÌ´Ù. `architecture` ºÎºÐ¿¡¼´Â Ä«¿îÅÍÀÇ µ¿ÀÛ ¹æ½ÄÀ» Á¤ÀÇÇϸç, ³»ºÎÀûÀ¸·Î »ç¿ëÇÒ ·¹Áö½ºÅÍ `count_reg`¸¦ ÃʱⰪ ``0000``À¸·Î ¼³Á¤ÇÑ´Ù. `process` ºí·Ï ³»¿¡¼´Â ¸®¼Â ½ÅÈ£°¡ È°¼ºÈµÉ ¶§ Ä«¿îÅ͸¦ ÃʱâÈÇÏ°í, Ŭ·°ÀÇ »ó½Â ¿¡Áö¿¡¼ Ä«¿îÅÍ °ªÀ» Áõ°¡½ÃÅ°´Â ·ÎÁ÷À» ±¸ÇöÇß´Ù. ¸¸¾à ¸®¼Â ½ÅÈ£°¡ `1`À̸é Ä«¿îÅ͸¦ 0À¸·Î ÃʱâÈÇϸç, Ŭ·° ½ÅÈ£ÀÇ »ó½Â ¿¡Áö¿¡¼ Ä«¿îÅ͸¦ ÇöÀç °ª¿¡ 1À» ´õ¡¦(»ý·«)
|