|
|
|
Anfang
zurück
weiter
Ende
|
Autor |
Beitrag |
s_rowse
Registrierter Benutzer
Beiträge: 2
|
Erstellt: 04.10.04, 14:47 Betreff: Comparator/Komparator
drucken
Thema drucken weiterempfehlen
|
|
|
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;
|
|
nach oben |
|
|
burn77
Registrierter Benutzer
Beiträge: 4
|
Erstellt: 05.10.04, 13:18 Betreff: Re: Comparator/Komparator
drucken
weiterempfehlen
|
|
|
Hi Sam,
I am not sure, if I can really help you. I tried to realize your comparator, but since I don't have the input of data_in, I just have realized some similar comparator...
greetings, burn
library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_signed.all; use ieee.numeric_std.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";
shared variable: count1 : integer := 0; signal clk1: std_logic := '0'; signal data_in1 : std_logic_vector(14 downto 0) := "001111111111111"; begin
clk1 <= not clk1 after 1 ns; -- I needed this since I don't have the inputs you have...
-- comparison process
process(clk1, data_in, rst) begin for i in 0 to 14 loop if(data_in(i) = sync_word(i)) then count1 <= count1 + 1; end if; end loop; correlation <= std_logic_vector(to_unsigned(count1,4)); count := 0; end process; end behave;
I am not sure, if this will help you, but I hope so. Especially, it is important to use a variable for counting, I think, so you just have to transform the format into std_logic_vector, the instruction "to_unsigned" is within numeric_std. All you have to realize is to connect the data_in with the internal signal data_in1 and you can compare any data_in with sync_word.
greetings, burn
|
|
nach oben |
|
|
s_rowse
Registrierter Benutzer
Beiträge: 2
|
Erstellt: 05.10.04, 13:43 Betreff: Re: Comparator/Komparator
drucken
weiterempfehlen
|
|
|
Ich probiere auf Deutsch zu schreiben... Vielen Dank! Ich hatte keine Ahnung, dass ich ein 'variable' benutzen mussten. Meinen Freund hat mir dass gerade jetzt gesagt
also, man muss IEEE.STD_LOGIC_ARITH.ALL benutzen. Thankyou so much for replying even though i wrote mostly in English!
here is a copy of the working version for anyone else who is interested :-)
------------------------------------------------------------------------------- -- Title : comparator ------------------------------------------------------------------------------- -- Description : Compares the bits of two 15 bit sequence and keeps a tally -- of how many of the 15 bits correlate. -------------------------------------------------------------------------------
library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_signed.all; USE IEEE.STD_LOGIC_ARITH.ALL;
entity comparator is port ( clk : in std_logic; -- clock signal rst_ls : in std_logic; -- rst signals used rst_ld : in std_logic; data_in : in std_logic_vector(14 downto 0); comparison : out std_logic_vector(3 downto 0)); end comparator;
architecture mix of comparator is constant sync_word : std_logic_vector (14 downto 0) := "001101011110001"; begin
-- comparison process
process(data_in, rst_ls, rst_ld) variable countValue : std_logic_vector(3 downto 0) := "0000"; begin if(rst_ls = '0' or rst_ld = '0') then countValue := "0000"; end if;
for i in 14 downto 0 loop if(data_in(i) = sync_word(i)) then countValue := countValue + 1; end if; end loop;
comparison <= countValue; end process;
end mix;
|
|
nach oben |
|
|
xiaoou
Vielschreiber
Beiträge: 53
|
|
nach oben |
|
|
Kllara
Stammgast
Beiträge: 41
|
Erstellt: 04.08.19, 16:36 Betreff: Re: Comparator/Komparator
drucken
weiterempfehlen
|
|
|
the number of bits that match is called the
|
|
nach oben |
|
|
thomas Li
Gast
|
|
nach oben |
|
|
cvasdve
Gast
|
Erstellt: 17.10.20, 14:02 Betreff: Re: Comparator/Komparator
drucken
weiterempfehlen
|
|
|
Golden Goose Starter ,
Golden Goose Superstar ,
Golden Goose Superstar ,
Golden Goose Francy ,
Golden Goose Hanami ,
Balenciaga Sneakers ,
Golden Goose Mid Star ,
Golden Goose Purestar ,
Golden Goose Superstar ,
air force 1 kids ,
air force 1 mid ,
Golden Goose Purestar Woman ,
Golden Goose Man ,
Golden Goose Yeah ,
Golden Goose Hi Star ,
Balenciaga Speed Sneakers ,
Golden Goose Starter ,
Golden Goose Ball Star ,
Golden Goose Starter Woman ,
Golden Goose Francy ,
Golden Goose Purestar ,
Golden Goose Yeah Woman ,
Golden Goose Sneakers Sale ,
Golden Goose Hi Star ,
air force 1 lx ,
GGDB Ball Star ,
Golden Goose Superstar Woman ,
Golden Goose Mid Star ,
Golden Goose Superstar ,
Golden Goose Superstar Man ,
Golden Goose Yeah ,
Balenciaga Triple S Sneakers ,
Golden Goose ,
Golden Goose Yeah ,
air force 1 shadow ,
maharishi air force 1 ,
air force 1 high ,
Golden Goose Starter ,
Golden Goose Woman ,
Golden Goose Ball Star ,
Golden Goose Slide ,
Air Force 1 ,
GGDB Starter ,
off white air force 1 ,
GGDB Mid Star ,
Golden Goose Starter ,
Balenciaga Slide ,
Balenciaga Sandals ,
air force 1 sage ,
air force 1 womens ,
Golden Goose Francy ,
Golden Goose Purestar Man ,
Golden Goose Stardan ,
GGDB Stardan ,
Golden Goose Starter Man ,
Golden Goose Francy ,
Golden Goose Superstar ,
Golden Goose Hi Star ,
Golden Goose Purestar ,
supreme air force 1 ,
Golden Goose Slide ,
GGDB Slide ,
GGDB Purestar ,
GGDB Francy ,
Alexander McQueen Women ,
Golden Goose Yeah Man ,
Golden Goose Hi Star ,
air force 1 ac ,
air force 1 react ,
Golden Goose ,
Golden Goose Starter ,
Golden Goose Ball Star ,
Golden Goose Starter ,
GGDB Superstar ,
Golden Goose Slide ,
GGDB Hi Star ,
Golden Goose Purestar ,
air force 1 utility ,
Golden Goose Purestar ,
Golden Goose Yeah ,
Golden Goose Sneakers ,
Golden Goose Slide ,
air force 1 lv8 ,
Golden Goose Superstar ,
Golden Goose Yeah ,
air force 1 upstep ,
Golden Goose Mid Star ,
air force 1 qs ,
air force 1 mens ,
nba air force 1 ,
Golden Goose Superstar ,
Golden Goose ,
Golden Goose Starter ,
Golden Goose Sneakers ,
Common Projects Sneakers ,
Golden Goose V Star ,
travis scott air force 1 ,
Common Projects Woman ,
Alexander Mcqueen Sneakers ,
Golden Goose Ball Star ,
Golden Goose Francy ,
air force 1 low ,
Golden Goose Mid Star ,
air force 1 premium ,
Golden Goose Stardan ,
Golden Goose Stardan ,
clot air force 1 ,
Golden Goose Purestar ,
Golden Goose Stardan ,
Golden Goose Hi Star ,
Golden Goose Purestar ,
Golden Goose Slide ,
air force 1 07 ,
air force 1 custom ,
Alexander McQueen Man ,
Golden Goose Mid Star ,
Common Projects Man ,
Golden Goose Ball Star ,
|
|
nach oben |
|
|
|
powered by carookee.com - eigenes profi-forum kostenlos
Design © trevorj
|