confusion when resetting registers

M

martin f. krafft

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
 
J

Jeroen

martin f. krafft said:
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
 
P

Paul Sereno

Jeroen said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Shift registers 1
A real math problem. 5
Reset Logic Function 1
Arduino Chess Clock 1
Implementation a SVM ( SVPWM) in FPGA with VHDL 0
2 flip-flop synchronizer 1
VHDL program error 2
Reset Logic Function 0

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top