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

Reply

VHDL - confusion when resetting registers

 
Thread Tools Search this Thread
Old 08-18-2004, 04:45 PM   #1
Default confusion when resetting registers


Hi all,

A student of mine is currently working on an implementation of
artificial neurons in FPGAs. We are experiencing a weird problem
trying to reset. I am only the messenger here (because I use
usenet), but from what I understand, the problem is as follows:

The weights connecting neurons are stored as 8 bit values in an
array (std logic vector) and there is a button that we want to use
to reset all weights to zero. The button is value '1' when not
pressed and '0' when pressed. Here is the logic we tried:

Reset: process (clock,Rst_n)
begin
if (clock'event and clock='1') then
ResP <= Rst_n;
end if;
end process Reset;

ResetAndClock: process (clock, ResP)
begin
if (ResP = '0') then
RegWeightsP <= (others => '0');
RegDIPvalueP <= (others => '0');
elsif (clock'event and clock='1') then
RegWeightsP <= RegWeightsN;
RegDIPvalueP <= DIPvalue;
end if;
end process ResetAndClock;

The idea is to force the creation of a flip-flop ResP to stabilise
the reset button value. In the second process, this register is then
queried and the weights reset if it's '0' or propagated if not.

I am not exactly sure why he uses *P and *N (the previous and next
values), but I believe it has to do with stabilisation.

Anyway, the problem is that the reset works fine while the button is
pressed, but as soon as we let go, the weight registers assume their
old values.

What are we doing wrong?

You can find the complete implementation of the neuron at

ftp://ftp.madduck.net/scratch/neuron.vhdl

Suggestions, comments, anything about the whole code or other parts
or whatever are very welcome. Primarily we would like to get the
reset switch working though.

Also, if any of the above is unclear, please ask and I will try to
clarify as best as I can.

Thanks a bunch,

Martin Krafft
AILab, Univ. ZĂĽrich, Switzerland


martin f. krafft
  Reply With Quote
Old 08-18-2004, 09:16 PM   #2
Jeroen
 
Posts: n/a
Default Re: confusion when resetting registers

"martin f. krafft" <> wrote in message
news:...
> Hi all,
>
> A student of mine is currently working on an implementation of
> artificial neurons in FPGAs. We are experiencing a weird problem
> trying to reset. I am only the messenger here (because I use
> usenet), but from what I understand, the problem is as follows:
>
> The weights connecting neurons are stored as 8 bit values in an
> array (std logic vector) and there is a button that we want to use
> to reset all weights to zero. The button is value '1' when not
> pressed and '0' when pressed. Here is the logic we tried:
>
> Reset: process (clock,Rst_n)
> begin
> if (clock'event and clock='1') then
> ResP <= Rst_n;
> end if;
> end process Reset;
>
> ResetAndClock: process (clock, ResP)
> begin
> if (ResP = '0') then
> RegWeightsP <= (others => '0');
> RegDIPvalueP <= (others => '0');
> elsif (clock'event and clock='1') then
> RegWeightsP <= RegWeightsN;
> RegDIPvalueP <= DIPvalue;
> end if;
> end process ResetAndClock;
>


RegWeightsN is not reset; I assume this signal is driven from somewhere
else.

Jeroen




Jeroen
  Reply With Quote
Old 08-19-2004, 07:29 AM   #3
Paul Sereno
 
Posts: n/a
Default Re: confusion when resetting registers
"Jeroen" <> wrote in message news:<4123b9c2$0$48933$>...
> "martin f. krafft" <> wrote in message
> news:...
> > Hi all,
> >
> > A student of mine is currently working on an implementation of
> > artificial neurons in FPGAs. We are experiencing a weird problem
> > trying to reset. I am only the messenger here (because I use
> > usenet), but from what I understand, the problem is as follows:
> >
> > The weights connecting neurons are stored as 8 bit values in an
> > array (std logic vector) and there is a button that we want to use
> > to reset all weights to zero. The button is value '1' when not
> > pressed and '0' when pressed. Here is the logic we tried:
> >
> > Reset: process (clock,Rst_n)
> > begin
> > if (clock'event and clock='1') then
> > ResP <= Rst_n;
> > end if;
> > end process Reset;
> >
> > ResetAndClock: process (clock, ResP)
> > begin
> > if (ResP = '0') then
> > RegWeightsP <= (others => '0');
> > RegDIPvalueP <= (others => '0');
> > elsif (clock'event and clock='1') then
> > RegWeightsP <= RegWeightsN;
> > RegDIPvalueP <= DIPvalue;
> > end if;
> > end process ResetAndClock;
> >

>
> RegWeightsN is not reset; I assume this signal is driven from somewhere
> else.
>
> Jeroen


Martin,
I do not understand what you mean with
"the problem is that the reset works fine while the button is pressed,
but as soon as we let go, the weight registers assume their old
values."
Analyzing the ResetAndClock process, the first part (if) will be
executed when ResP be equal to '0' (bottom press), the registers get
'0'. When the bottom is released the 'elsif' part will be executed
(ResP='1'). In this part RegWeightsP will get whatever value is in the
RegWeightsN signal. If RegWeightsN has not changed since the previous
active clock edge, RegWaithsP will get an 'old' value from
RegWeightsN. . . So, check when RegWeightsN changes and then check
whether RegWeightsP is update on the next rising edge of the clock.

paul


Paul Sereno
  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
confusion with credit towards the Mobile certification. giddy MCTS 0 07-23-2008 05:29 AM
Adding two registers A and B in vhdl Haai Hardware 0 08-18-2007 04:56 PM
Address Bus and External Data Bus Confusion LoXodonte A+ Certification 1 04-18-2006 10:09 PM
Resetting The Counter. Patrick D. Rockwell DVD Video 3 07-09-2004 10:32 PM
Lockup/Reboot confusion Bloke_in_a_box A+ Certification 2 05-12-2004 06:56 PM




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