Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

vhdl code of 32 bit counter

Status
Not open for further replies.

sailakshmi

Newbie level 2
Joined
Feb 21, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
hyd
Activity points
1,290
vhdl code for 32 bit counter so please help me.......................................vhdl code
 

Code:
library IEEE;
use IEEE.std_logic_1164.all;

entity cntr is
  generic(left    : natural := 31;       
          prop    : time := 100 ps);     
  port   (clk     : in  std_logic;
          load    : in  std_logic;
          in_load : in  std_logic_vector (left downto 0);
          output  : out std_logic_vector (left downto 0) );
end entity cntr_g;

architecture behavior of cntr is
begin  
  cntr: process(clk, load)
          variable counter : std_logic_vector(left downto 0);
          variable carry   : std_logic;
          variable tcarry  : std_logic;
        begin
          if load='1' then
            counter := in_load;
            output <= in_load;
          elsif clk'event and clk='1' then 
            carry := '1';
            for i in 0 to left loop
              tcarry  := counter(i) and carry;
              counter(i) := counter(i) xor carry;
              carry := tcarry;
            end loop;
            output <= counter after prop;
          end if;
        end process cntr;
end architecture behavior;
--
Amr Ali
 

hi,

see the same topic at



but do small change , from 127 to 31
and
signal count: std_logic_vector (31 downto 0):= (others=>'0');

but that without " reset "

thank
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top