Serial sequential adder  v.1.0
Example documentation project, author Vladimir Petrović
serial_adder.vhd
Go to the documentation of this file.
1 
14 
15 
16 library ieee;
17 use ieee.std_logic_1164.all;
18 
27 entity serial_adder is
28  port
29  (
31  reset : in std_logic;
33  clk : in std_logic;
34 
36  a_s : in std_logic;
38  b_s : in std_logic;
39 
41  sum_s : out std_logic
42  );
43 end serial_adder;
44 
54 architecture serial_add_behav of serial_adder is
55  -- state definitions
57  type state_type is (cout_0, cout_1);
58 
59  -- signal definitions
61 
62  signal carry_out: std_logic;
63  signal carry_in: std_logic;
64 
65  -- components declaration
66  component fulladder is
67  port
68  (
69  a : in std_logic;
70  b : in std_logic;
71  cin : in std_logic;
72  s : out std_logic;
73  cout : out std_logic
74  );
75  end component;
76 
77 
78 begin
79  FA: fulladder port map (a_s, b_s, carry_in, sum_s, carry_out);
80 
82  serial_adder_state_transition: process(reset,clk) is
83  begin
84  if (reset = '1') then
85  state_reg <= cout_0;
86  elsif (rising_edge(clk)) then
88  end if;
89  end process;
90 
92  serial_adder_next_state_logic: process (carry_out) is
93  begin
94  if (carry_out = '0') then
95  next_state <= cout_0;
96  else
97  next_state <= cout_1;
98  end if;
99  end process;
100 
101  carry_in <= '0' when state_reg = cout_0 else
102  '1' when state_reg = cout_1;
103 
104 end serial_add_behav;
in a_sstd_logic
Serial input 1.
out sstd_logic
Output sum.
Definition: fulladder.vhd:29
(cout_0,cout_1) state_type
Definition of states of serial_adder state machine. See detailed description for more details...
in resetstd_logic
Sequential circuit reset signal.
Entitiy declaration for fulladder.
Definition: fulladder.vhd:18
in clkstd_logic
clk signal
in bstd_logic
Input bit 2.
Definition: fulladder.vhd:24
_library_ ieeeieee
Definition: fulladder.vhd:1
in b_sstd_logic
Serial input 2.
in cinstd_logic
Input carry.
Definition: fulladder.vhd:26
out sum_sstd_logic
Serial output sum.
in astd_logic
Input bit 1.
Definition: fulladder.vhd:22
Entitiy declaration for serial_adder.
out coutstd_logic
Output carry.
Definition: fulladder.vhd:32