Академический Документы
Профессиональный Документы
Культура Документы
Project Guide:
AIM
XILINX
MODELSIM SIMULATOR
MULTISIM
INTRODUCTION OF THE NEURON
An Artificial Neural Network (ANN) is an
information processing paradigm that is inspired
by the way biological nervous systems, such as
the brain process information.
An artificial neuron is a device with many inputs
and one output.
The neuron has two modes of operation; the
training mode and the using mode.
Dendrites of a neuron are considered as inputs
and axon as the output.
THE NERVOUS SYSTEM
The human nervous system can be broken down into three stages
that may be represented in block diagram form as:
entity mux4 is
port (A1, A2 : in std_logic_vector (3 downto 0);
sel : in std_logic;
Y : out std_logic_vector (3 downto 0));
end mux4;
architecture Behavioral of mux4 is
begin
process (A1,A2,sel)
begin
if Sel = '0' then
Y <= A1 ;
else
y <= A2;
end if;
end process;
end Behavioral ;
VHDL OF COUNTER MODULO-1
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity counter is
port(clr,ce,oe,clk:in std_logic;
q:inout std_logic);
end counter;
end process;
end Behavioral;
MULTIPLIER
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
package converter1 is
function btoi(a:in std_logic_vector(3 downto 0)) return integer;
procedure itob(a:in integer; b:out std_logic_vector(7 downto 0));
end package converter1;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity rtg is
Port ( RIN : in std_logic_VECTOR(7 DOWNTO 0 );
EN_R : in std_logic;
ROUT : out std_logic_VECTOR(7 DOWNTO 0 ));
end rtg;
architecture Behavioral of rtg is
begin
PROCESS(RIN,EN_R)
BEGIN
end Behavioral;
FINITE STATE MACHINE
The state vector (also current state, or just state) is the value
currently stored by the state memory. The next state of the
machine is a function of the state vector and the inputs. Mealy
outputs are a function of the state vector and the inputs while
Moore outputs are a function of the state vector only.
CLK is the clock of the system. High RESET can stop everything
in finite state machine and START is the signal which allows the
neuron to begin its functioning after RESET is low.
VHDL CODING OF FINITE STATE MACHINE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity fsma is
port(clk,reset,start,end_in:in std_logic ;
en_count,en_r,ce,clr,end_fsm:out std_logic);
end fsma;
begin
process(clk,reset,start,end_in)
variable a:std_logic_vector(2 downto 0);
variable i,j:integer:=0;
variable b: std_logic;
begin
process(clk,reset,start,end_in)
variable a:std_logic_vector(2 downto 0);
variable i,j:integer:=0;
variable b: std_logic;
begin
if(reset='1') then
a:="000";en_count<='0';
en_r<='0';
ce<='0';
clr<='0';
elsif (end_in = '1') then
clr<='1';en_r<='0';
ce<='0';
en_count<='0';
a(i):= a(i+1);
end loop;
a(2) := b;
en_count<=a(2); en_r<=a(1);
ce<=a(0);
end if ;
else clr<='0';en_r<='0';
ce<='0';
en_count<='0';
end if;
end process;
end Behavioral;
CODING OF 2’COMPLEMENT
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity compliment is
Port ( CIN : in std_logic_vector(7 DOWNTO
0 );
COUT : out std_logic_vector(7 DOWNTO
0 ));
end compliment;
architecture Behavioral of compliment is
begin
PROCESS(CIN)
VARIABLE V : std_logic_vector(7 DOWNTO 0 );
BEGIN
END PROCESS;
end Behavioral;
ADDITION AND ACCUMULATION
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity add is
Port (B : in std_logic_vector(7 DOWNTO 0 );
clr,ce : in std_logic;
CO: out std_logic;
accu :inout std_logic_vector(7 downto
0));
end add;
architecture Behavioral of add is
begin
process(B,ce,clr)
variable Y:std_logic_vector(7 downto 0);
variable count : integer:=0;
begin
if (clr = '1') then
accu <="00000000" ;
elsif (ce = '1') then
accu <= B;
else accu<="11111111" ;
if((accu(7)='1' and B(7)='1')or((accu(7)='1' OR
B(7)='1')AND B(6)='1'AND accu(6)='1')) THEN
CO<='1';
else CO<='0';
end if;
end if;
end process;
end Behavioral;
VHDL CODING OF ACTIVATION FUNCTION
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity acti is
port(a: std_logic_vector(7 downto 0);
sign : in std_logic;
output: out std_logic);
end acti;
architecture Behavioral of acti is
begin
process (sign,a)
begin
if (sign = '0') then
output <= '0';
elsif (sign = '1') then
if (a >= "10000000") then
output <= '1';
else output <= '0';
end if;
end if;
end process;
end Behavioral;
INTERFACING
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity PROJECTNEURON is
port (A1,A2: in std_logic_vector(3 downto 0);
W1,W2: in std_logic_vector(3 downto 0);
clk1,clr,oe,ce : in std_logic;
clk,reset,start,end_in :in std_logic;
SA1,SA2,SW1,SW2 :in std_logic;
output: out std_logic);
end PROJECTNEURON;
architecture Behavioral of PROJECTNEURON is
component add
port(B : in std_logic_vector(7 DOWNTO 0 );
ce,clr : in std_logic;
CO : out std_logic;
accu : inout std_logic_vector(7 downto 0));
end component;
component acti
port (a: std_logic_vector(7 downto 0);
sign : in std_logic;
output: out std_logic);
end component;
component compliment
port (CIN : in std_logic_vector(7 DOWNTO 0 );
COUT : out std_logic_vector(7 DOWNTO 0 ));
end component;
component mux2
port (A1, A2 : in std_logic;
sel : in std_logic;
Y : out std_logic);
end component;
component counter
port (ce,oe,clr:in std_logic;
clk : in std_logic;
q:inout std_logic);
end component;
component fsma
port (clk,reset,start,end_in:in std_logic;
en_count,en_r,ce,clr:out std_logic);
end component;
component mul
port (a,b:in std_logic_vector(3 downto 0);
s:out std_logic_vector(7 downto 0));
end component;
component mux4
port (A1, A2 : in std_logic_vector(3 downto 0);
sel : in std_logic;
Y : out std_logic_vector (3 downto 0));
end component;
component rtg
Port ( RIN : in std_logic_vector(7 DOWNTO 0 );
EN_R : in std_logic;
ROUT : out std_logic_vector(7 DOWNTO 0 ));
end component;
component mux8
port (A1, A2 : in std_logic_vector (7 downto 0);
sel : in std_logic;
Y : out std_logic_vector (7 downto 0));
end component;
Used in medicines
Electronic noses
Instant Physician