- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.all; USE IEEE.STD_LOGIC_UNSIGNED.all; USE IEEE.STD_LOGIC_ARITH.all; ENTITY counter IS PORT(enable, clr : IN STD_LOGIC; THECOUNT : OUT STD_LOGIC_VECTOR(5 downto 0)); END counter; ARCHITECTURE a OF counter IS SIGNAL tmp: STD_LOGIC_VECTOR(5 downto 0); BEGIN PROCESS(enable, CLR) BEGIN IF (CLR='1') THEN tmp <= "000000"; ELSIF (enable'event and enable='1') THEN tmp <= tmp + 1; END IF; end process; THECOUNT <= tmp; end a; This is the code I am using to work a counter.. I use the simulator tool to discover that THECOUNT never increases after CLR goes low. THECOUNT is always 0. Is there something I am doing wrong? Thanks in advance for any help!Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you connect a valid clock signal on enable pin?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes.. : / Any other ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Surely the problem is with simulator settings or input waveform.
I tried to simulate your code and it works. I used the following stimuli: enable : clock signal, period 10ns clr : 100ns high then low When clr goes down, counter starts incrementing.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page