Duke Scarring wrote:
> 1. Show us, what have you done so far.
> 2. Ask particular questions.
ok
how i make it in vhdl code
d(s1,s2)=(1+1+0+1+1)/(n^2/2)=4/12=0.33333 .
1 | library ieee;
|
2 | use ieee.std_logic_1164.all;
|
3 | library ieee;
|
4 | use ieee.std_logic_1164.all;
|
5 |
|
6 | entity test is
|
7 | port(
|
8 | rst : in std_logic;
|
9 | clk : in std_logic;
|
10 | we : in std_logic;
|
11 | wr_data1 : in std_logic_vector(7 downto 0);
|
12 | wr_data2 : in std_logic_vector(7 downto 0);
|
13 | wr_addr : in integer range 0 to 255;
|
14 | N_of_samp: out integer range 0 to 255;
|
15 | distance : out integer range 0 to 255;
|
16 | sum : out integer range 0 to 255;
|
17 | vout : out std_logic;
|
18 | no_match : out std_logic
|
19 | );
|
20 | end entity;
|
21 | signal accum : integer range 0 to 255 := 0;
|
22 | signal dis : integer range 0 to 255 := 0;
|
23 | signal n : integer range 0 to 255 := 0;
|
24 | process (n,accum)
|
25 | begin
|
26 | if (n mod 2) /= 0 then
|
27 | N_of_samp <= (n*n)-1;
|
28 | else
|
29 | N_of_samp <= (n*n);
|
30 | end if;
|
31 |
|
32 | end process;
|
33 | end rtl;
|
i try to do it in a part of the code but it calculate n
like(1,2,3,....10)
and test it if even make n*n and if odd make n*n-1
and i want to use the result oonoly i.e i want t use the result of
conter 10 and test it then make division but it gave me result like the
picture attached.
i hope y understand me