Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - signal change not detected

 
Thread Tools Search this Thread
Old 08-25-2008, 02:26 PM   #1
Default signal change not detected


Following is the code... Though in the process "process_count", I have
the signal "count" in the sensitivity list, reset1 is not going to '0'
after the desired count value as is given below in the code. What is
the problem? I am using modelsim.


library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std.all;
use work.myram1024.all;
entity acmdat is
port(clk: in std_logic;
reset: in std_logic;
indexin : out std_logic_vector(ADDRESS_WIDTH - 1 downto 0);
xr,yr,xi,yi : out std_logic_vector(21 downto 0):=(others=>'0'));
end acmdat;
architecture archi of acmdat is
component acmadd
port(clk,reset:in std_logic;
q1: out std_logic_vector(9 downto 0):=(others=>'0'));
end component;
signal count : std_logic_vector(12 downto 0):=(others=>'0');
signal reset1 : std_logic;
begin
process(clk,reset,count)
begin
if reset = '1' then
if(clk'event and clk='1') then
xr <= std_logic_vector(to_signed(2,22));
xi <= std_logic_vector(to_signed(1,22));
yr <= std_logic_vector(to_signed(1,22));
yi <= std_logic_vector(to_signed(2,22));
count<= count + "0000000000001";
end if;
end if;
end process;
u1: acmadd port map(clk,reset,indexin);
process_countrocess(count,clk,reset)
begin
reset1 <= reset;
if count = "1000000000001"and(clk'event and clk='1') then
reset1 <= '0';
end if;
---end if;
end process;
end archi;

The above module has one component and it's code is....

use ieee.numeric_std.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity acmadd is
port(clk,reset:in std_logic;
q1: out std_logic_vector(9 downto 0):=(others=>'0'));
end acmadd;
architecture archi of acmadd is
signal s1 : std_logic_vector(9 downto 0):=(others=>'0');
signal count: std_logic_vector(9 downto 0):="0000000000";
signal b: std_logic_vector(9 downto 0) :="0000000001";
begin
process_count: process(clk,reset)
begin
if(reset ='1') then
if(clk'event and clk='1') then
s1<= "0000000000";
count<= (count+b);
s1<= count;
end if;
end if;
end process;
q1<=s1;
end archi;


koyel.aphy@gmail.com
  Reply With Quote
Old 08-25-2008, 03:45 PM   #2
koyel.aphy@gmail.com
 
Posts: n/a
Default Re: signal change not detected
process_countrocess(count,clk,reset)
begin
reset1 <= reset;
if count = "1000000000001"and(clk'event and clk='1') then
reset1 <= '0';
end if;
---end if;
end process;

The problem is I want the signal reset1 to be continuously low after
the count "1000000000001" which is 4097. I found that it only goes to
0 at the rising edge of clock pulse with the count 4097 and again goes
high which is probably due to the reset1<=reset otherwise. Hence, I
modifies the code as below

process(count,clk,reset)
begin
if count < "1000000000001" then
reset1 <= reset;
elsif count >= "1000000000001"and(clk'event and clk='1') then
reset1 <= '0';
end if;
---end if;
end process;

that works fine in simulation but please let me know if these
operators can be used in harware implementation or not?

Best Regards


koyel.aphy@gmail.com
  Reply With Quote
Old 08-25-2008, 04:33 PM   #3
koyel.aphy@gmail.com
 
Posts: n/a
Default Re: signal change not detected
final code is

process(count,clk,reset)
begin
if count < 4097 then
reset1 <= reset;
elsif count >= 4097 and(clk'event and clk='1') then
reset1 <= '0';
end if;
---end if;
end process;

I declared count as an integer with 0 initialization since the range
for a 13 bit std_logic_vector is limited. It's just a data generator
for one of my design modules which should stop after 4097th data. I am
not going to implement it on harware but still the question about the
> and < operator is not known to me.



koyel.aphy@gmail.com
  Reply With Quote
Old 08-25-2008, 04:36 PM   #4
KJ
 
Posts: n/a
Default Re: signal change not detected
On Aug 25, 10:45*am, koyel.a...@gmail.com wrote:
> process_countrocess(count,clk,reset)
> begin
> reset1 <= reset;
> if count = "1000000000001"and(clk'event and clk='1') then
> reset1 <= '0';
> end if;
> ---end if;
> end process;
>
> The problem is I want the signal reset1 to be continuously low after
> the count "1000000000001" which is 4097. I found that it only goes to
> 0 at the rising edge of clock pulse with the count 4097 and again goes
> high which is probably due to the reset1<=reset otherwise. Hence, I
> modifies the code as below
>
> process(count,clk,reset)
> begin
> if count < "1000000000001" then
> reset1 <= reset;
> elsif count >= "1000000000001"and(clk'event and clk='1') then
> reset1 <= '0';
> end if;
> ---end if;
> end process;
>
> that works fine in simulation but please let me know if these
> operators can be used in harware implementation or not?
>


It likely won't reliably work in hardware. The problem is that signal
'reset1' will be asynchronously set to the value of 'reset' when
'count' hits the magic value. In order to implement this, the
hardware would have to check all of the bits of count and use that to
either asynchronously preset the flop for reset1 (if reset is '1') or
asynchronously reset the flop for reset1 (if reset is '0').

Consider rewriting your code a bit to be a straight synchronous
process as shown below and don't use asynchronous inputs at all. By
doing so you'll be avoiding a whole slew of "it works in sim, but not
in hardware" types of problems.

process(clk)
begin
if rising_edge(clk) then
-- Put your logic here
end if;
end process;

KJ


KJ
  Reply With Quote
Old 08-25-2008, 04:46 PM   #5
koyel.aphy@gmail.com
 
Posts: n/a
Default Re: signal change not detected

Okay thank you very much for this information. I didn't know this. I
will keep my inputs synchronous now onwards. But please let me know
about the operators. Can we use them in hardware implementation. If
yes, then why do we have comparators in the ip cores of the
configuring softwares.

Best Regards


koyel.aphy@gmail.com
  Reply With Quote
Old 08-25-2008, 04:48 PM   #6
KJ
 
Posts: n/a
Default Re: signal change not detected
On Aug 25, 11:33*am, koyel.a...@gmail.com wrote:
> I am
> not going to implement it on harware but still the question about the
> > and < operator is not known to me.

>


The > and < operators will synthesize just fine in hardware.

As I mentioned in the other post though your use of async logic is
pretty dicey when it comes to being implemented in hardware...although
between your last two posts it's not clear if you want this in
hardware or not (you've implied both 'yes' and 'no'). If it's not
intended for hardware then whether or not hardware implements the
operators is moot (but I answered it above anyway).

KJ


KJ
  Reply With Quote
Old 08-25-2008, 04:53 PM   #7
KJ
 
Posts: n/a
Default Re: signal change not detected
On Aug 25, 11:46*am, koyel.a...@gmail.com wrote:
> Okay thank you very much for this information. I didn't know this. I
> will keep my inputs synchronous now onwards. But please let me know
> about the operators. Can we use them in hardware implementation.


Yes you can use the >, < and = operators to implement hardware.

> If
> yes, then why do we have comparators in the ip cores of the
> configuring softwares.
>


I'm not sure which cores and software you're talking about but as a
general statement I'd say that having different ways of doing things
is a good thing.

KJ


KJ
  Reply With Quote
Old 08-26-2008, 12:30 PM   #8
koyel.aphy@gmail.com
 
Posts: n/a
Default Re: signal change not detected
> I'm not sure which cores and software you're talking about but as a
> general statement I'd say that having different ways of doing things
> is a good thing.


for example xilinx.

Thanks. No I do not want this particular design to be implemented in
hardware. It's just for testing another block in simulation as this is
simpler than writing a test bench and also saves from forcing inputs
at each clock pulse when running the simulation. But at some point I
will need a more appropriate data source to test the designs in
hardware and then it is highly probable that I use the > and <
operators. That is why it is also useful for me to know that the
inputs must be synchronous.In my other codes, I didn't have to use
asynchronous inputs so probably didn't get into this problem before.

Thanks again.


koyel.aphy@gmail.com
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
I am having trouble editing a signal in a sub program. Haai Hardware 0 08-28-2007 02:58 PM
IMHO, Digital SECAM video is better than Analog NTSC video Radium DVD Video 167 10-25-2006 04:16 AM
Why We Resist Change @ The TechZone Silverstrand Front Page News 0 09-07-2006 12:01 PM
If I could change the LotR movies... Opticreep DVD Video 33 03-03-2004 12:36 PM
Can't Change IRQs in Windows 2000 Alicia White A+ Certification 8 09-01-2003 08:54 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46