パリティチェッカ

掲載ページ:76、リスト番号:4.11

【VHDL記述】


library IEEE;

use IEEE.std_logic_1164.all;

entity PARITY_CHECKER is

port ( A : in std_logic_vector(7 downto 0);

Y : out std_logic );

end PARITY_CHECKER;

architecture DATAFLOW of PARITY_CHECKER is

begin

process ( A )

variable TMP : std_logic;

begin

TMP := '0';

-- for-loop文による繰り返し処理

for I in 0 to 7 loop

TMP := TMP xor A(I);

end loop;

Y <= TMP;

end process;

end DATAFLOW;

【Verilog-HDL記述】


module PARITY_CHECKER (

A,

Y

);


input[ 7 : 0 ] A;

output Y;


// リダクション演算子による繰り返し処理

assign Y = ^ A;

endmodule

【合成結果】