Päritetsgenerator VHDL

OP #1013998
Lesenswert?
• ▲
▼
entity PARGEN8 is
port( D_Input : in std_logic_vector;
      EVEN_output : out std_logic;
      ODD_output : out std_logic);
end PARGEN8;
architecture Behaviour of PARIGEN8 is
signal D_Input :  std_logic_vector (7 downto0);
begin
PARGEN: process( D_input )
begin
variable p std_logic;
begin
p:= D_input(1);
for I in 1 to 7 loop
if D_input(I)='1' then p := not p;
end if;
end loop;
if PAR then GERADE <= '1';
else GERADE <= '0';
end if;
EVEN <= not p;
ODD <= p;
end process PARGEN8;
end Behaviour;
#1014100
Lesenswert?
• ▲
▼
@ Irina "l" (irinal)

>Ja, klar, das habe ich vergessen. Und Rest?

Im Prinzip richtig, wenn gleich recht akademisch. Ich würde es so 
machen.

1
entity PARGEN8 is
2
port( D_input     : in std_logic_vector(7 downto 0);
3
      EVEN_output : out std_logic;
4
      ODD_output  : out std_logic);
5
end PARGEN8;
6

7
architecture Behaviour of PARIGEN8 is
8
begin
9

10
PARGEN: process( D_input )
11
    variable p std_logic;
12
  begin
13
    p:= D_input(0);
14
    for i in 1 to 7 loop
15
      p := p XOR D_input(i);
16
    end loop;
17
    EVEN <= p;
18
    ODD <= not p;
19
  end process;
20

21
end Behaviour;

MFG
Falk

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren