![]() |
|
|
|||||||
![]() |
VHDL - confusion when resetting registers |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
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 |
|
|
|
|
#2 |
|
Posts: n/a
|
"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 |
|
|
|
#3 |
|
Posts: n/a
|
"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 |
|
![]() |
| Thread Tools | Search this Thread |
|
|
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 |