s_rowse
Registrierter Benutzer
Beiträge: 2
|
Erstellt: 04.10.04, 14:47 Betreff: Comparator/Komparator |
|
|
Hallo,
Es tut mir leid, aber ich habe Deutsch seit einem langem Zeit nicht gesprochen, und ich kann keine Englisches VHDL forum finden. Ich brauch hilfe mit meinem parallel Komparator. Und leider jetzt muss ich auf Englisch sprechen... I would be really appreciative if anyone could answer my post even though i've had to write in english to get my point across!
I'm having trouble getting my comparator to work. The idea is: the comparator compares two 15 bit sequences, and tallies up how many bits in the sequences have the same position and value. the number of bits that match is called the correlation value. for example "1111" and "1111" have a correlation of 4 "0011" and "1100" have a correlation of 0, etc.
I tried making a for loop to do this. I then tested it by seeing what happened when two exactly the same sequences were compared over and over. instead of outputting a correlation value of "1111" (15) over and over, i found that it starts at 0 and counts from 0 to 15 by ones, which is not what it's supposed to do!
I have pasted my code below, there's not much. If you can give me some tips so i can fix it that would be fantastic! Thankyou! Sam
library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_signed.all;
entity comparator is port ( clk : in std_logic; -- clock signal rst; -- reset signal data_in : in std_logic_vector(14 downto 0); correlation : out std_logic_vector(3 downto 0)); end comparator;
architecture behave of comparator is constant sync_word : std_logic_vector (14 downto 0) := "001101011110001"; signal count : std_logic_vector(3 downto 0) := "0000"; begin
-- comparison process
process(clk, data_in, rst) begin for i in 0 to 14 loop if(data_in(i) = sync_word(i)) then count <= count + "0001"; else count <= count; end if; end loop; correlation <= count; end process; end behave;
|
|