reseting all signals with vhdl

S

Symon

Alfreeeeed said:
Hi , I need help with some VHDL issue I have right now. I have to
reset all signals of a digital filter when a process detects a change
in the reset port. Is there any short way to do this besides assigning
each signal a zero value? I have approx. 30 signals so doing that will
be a waste , dont you think?.

Regards

Turn the power off.
HTH., Syms.
 
A

Alfreeeeed

Hi , I need help with some VHDL issue I have right now. I have to
reset all signals of a digital filter when a process detects a change
in the reset port. Is there any short way to do this besides assigning
each signal a zero value? I have approx. 30 signals so doing that will
be a waste , dont you think?.

Regards
 
M

MikeShepherd564

...I have to reset all signals of a digital filter...Is there any
short way to do this besides assigning each signal a zero value?
...approx. 30 signals so doing that will be a waste, dont you think?

A waste of what?
 
M

MikeShepherd564

A waste of time , writing each line for each signal assignment. I am
looking for effective code writing;

I think that, if we're to make progress with your idea, we need more
precision of expression. Do you really mean that you want to save
time in writing or do you want to save time for the reader?

I see a great deal of code which expresses the first (contemptible)
aim at the expense of the second (which is laudable).

Mike
 
K

kennheinrich

I think that, if we're to make progress with your idea, we need more
precision of expression. Do you really mean that you want to save
time in writing or do you want to save time for the reader?

I see a great deal of code which expresses the first (contemptible)
aim at the expense of the second (which is laudable).

Mike

Afre*d, how about posting the code you want to fix? If you have a 30-
tap FIR filter that's written as 30 separate lines of code, I can tell
you right off you should change your coding style to use generates or
more effective parameterization. Doing this, you will introduce
opportunities for conciseness which will help you express your reset
better. On the other hand, if you have a rat's net of control logic,
all of which must be individually reset, you have a different
restructuring problem. You can also do some creative things with
record types and constructor functions to make your code both more
readable and easy to modify. But without seeing more specifics, it's
hard to give a useful response.

- Kenn
 
M

Mike Treseler

Alfreeeeed said:
A waste of time , writing each line for each signal assignment. I am
looking for effective code writing;

Not so bad.

procedure init_regs is
begin
zero_read_data;
serial_out_v := '1'; -- no premature start bit
RxState_v := IDLE;
TxState_v := IDLE;
Tx_v := (others => '0');
Rx_v := (others => '0');
serialInRetimed_v := ('1', '1', '1'); -- no premature start bit
RxBitSampleCount_v := 0;
RxBitCount_v := 0;
TxBitSampleCount_v := 0;
TxBitCount_v := 0;
sample_tp_sim_only_v := false;
end procedure init_regs;

from http://home.comcast.net/~mike_treseler/uart.vhd
 
S

Symon

I think that, if we're to make progress with your idea, we need more
precision of expression. Do you really mean that you want to save
time in writing or do you want to save time for the reader?
Hi Mike,
My guess is the OP wants to save writing time. As someone who suffers from a
name spelling problem, I think he's probably still annoyed with his parents'
decision to add four extra 'e's into his name, which must add up to a lot of
extra typing over a lifetime.
Cheers, Syms.
 
A

Alfreeeeed

Afre*d, how about posting the code you want to fix? If you have a 30-
tap FIR filter that's written as 30 separate lines of code, I can tell
you right off you should change your coding style to use generates or
more effective parameterization. Doing this, you will introduce
opportunities for conciseness which will help you express your reset
better. On the other hand, if you have a rat's net of control logic,
all of which must be individually reset, you have a different
restructuring problem. You can also do some creative things with
record types and constructor functions to make your code both more
readable and easy to modify. But without seeing more specifics, it's
hard to give a useful response.

- Kenn

Thanks everybody for the feedback , I will try to be more clear this
time. I have an IIR SOS filter with 4 sections.
each section has 10 signals aproximately. The coefficients of the
multipliers are variable depending on the selected channel. What I am
trying to implement is a reset of all the signals of all the sections
so that when the new filter is selected , every signal of the filter
is clear. The first idea that comes in my mind to do these is a
process sensitive to a reset pin. -- The following is a quick
example , my code doesnt look like this--


process (reset)
begin
if ( reset'event and reset'last_value='0') then
signal_1<=(others => '0');

signal_2<=(others => '0');

signal_3<=(others => '0');

signal_4<=(others => '0');

signal_5<=(others => '0');



......etc etc until we reach the 40 signals.

end if;
end process;


So , any suggestions????

Thanks a lot
 
K

KJ

On Feb 1, 12:50 pm, (e-mail address removed) wrote:
Thanks everybody for the feedback , I will try to be more clear this
time.  I have an IIR SOS filter with 4 sections.
each section has 10 signals aproximately. The coefficients of the
multipliers are variable depending on the selected channel. What I am
trying to implement is a reset of all the signals of all the sections
so that when the new filter is selected , every signal of the filter
is clear.

The first question that comes to mind is 'Why do you think it's
important to reset all of these signals?'...and before you or someone
else says 'So that I know what state they are in' let me just say that
in general, data signals do not need to be initialized at all at
reset, and many times, only a small subset of control signals need to
be initialized at reset.

Get over the urge to reset everything, it is counterproductive and
wastes resources. Since your concern is the 'wasting time typing' to
put in the code to reset everything, you should instead put some
thought into figuring out just what signals really do need to be reset
instead...you'll find that very few of them need it.
The first idea that comes in my mind to do these is a
process sensitive to a reset pin. -- The following is a quick
example , my code doesnt look like this--

You'll need to get another idea. You will never use reset as a clock
type signal as you've shown in your code. Use a synchronous process
template

process(Clock)
begin
if rising_edge(Clock) then
if (Reset = '1') then
-- Reset signals here
else
-- normal operation here
end if;
end if;
end process;

Lastly, simulate your design (once you have it coded up).

Kevin Jennings
 
B

Brian Drummond

A waste of time , writing each line for each signal assignment. I am
looking for effective code writing;

Using an array (or conceivably record) containing all these signals, you could
reset them all with a single assignment.

You don't say what kind of digital filter, but an array would be ideal for an
FIR, and a small array of records would probably suit a chain of second order
IIR stages..

Use the type system to help you express what you are doing as clearly and
concisely as possible.

- Brian
 
B

Brian Drummond

The first question that comes to mind is 'Why do you think it's
important to reset all of these signals?'...and before you or someone
else says 'So that I know what state they are in'

in an IIR filter it's quite likely that avoiding transient outputs when
switching from one filter section to another is important.

Normal signal values for one filter could cause overload (and oscillation) for
another. Knowing the initial state may be unimportant, but proving it is both
linear and stable is another matter.

- Brian
 
N

Nicolas Matringe

Alfreeeeed a écrit :
Thanks everybody for the feedback , I will try to be more clear this
time. I have an IIR SOS filter with 4 sections.
each section has 10 signals aproximately. The coefficients of the
multipliers are variable depending on the selected channel. What I am
trying to implement is a reset of all the signals of all the sections
so that when the new filter is selected , every signal of the filter
is clear. The first idea that comes in my mind to do these is a
process sensitive to a reset pin. -- The following is a quick
example , my code doesnt look like this--


process (reset)
begin
if ( reset'event and reset'last_value='0') then
signal_1<=(others => '0');
signal_2<=(others => '0');
signal_3<=(others => '0');
signal_4<=(others => '0');
signal_5<=(others => '0');
.....etc etc until we reach the 40 signals.

end if;
end process;

So , any suggestions????


Hi
As has already been suggested, define an array instead of individual
signals.
The reset will be only one line :
signal <= (others => (others => '0'));

And if you need more (or less) signals, you only have to change your
array size.

Nicolas
 
K

KJ

Brian Drummond said:
in an IIR filter it's quite likely that avoiding transient outputs when
switching from one filter section to another is important.
I agree that the state values of the IIR would end up on the list of signals
that would need to be initialized. If the one writing the code to implement
the IIR didn't know much about IIR (and didn't consider why the states
holding the previous values would need some form of initialization) then
they would find it pretty quickly in simulation since the output of the IIR
would always be unknown. Signals such as these are the ones that require a
designed in way to be initialized, most other signals do not.
Normal signal values for one filter could cause overload (and oscillation)
for
another. Knowing the initial state may be unimportant, but proving it is
both
linear and stable is another matter.
Initial values do not affect stability of an IIR.

Stability can be (dis)proven by simple analysis to make sure that the poles
all end up inside the unit circle. Not doing this analysis prior to
implementation in any form is asking to waste time.

The switching of coefficients based on the channel (which the OP says he's
trying to do) should not affect stability, he should be switching between
sets that all form a stable IIR design.

Kevin Jennings
 
D

Dave Higton

In message <[email protected]>
Brian Drummond said:
in an IIR filter it's quite likely that avoiding transient outputs when
switching from one filter section to another is important.

but if you reset all the registers, you will /introduce/ a
transient if the value passing through the filter is non-zero.

Dave
 
A

Alfreeeeed

In message <[email protected]>



but if you reset all the registers, you will /introduce/ a
transient if the value passing through the filter is non-zero.

Dave

Ok , so basically what I need to do is declare all my signals in an
array or if needed in record types so the reseting code for the
signals would be at most the number of arrays declared. Is that right?

On the other hand, I am not sure if I really need to reset my signals
if I am changing coefficients. I believe I must to. Specially because
of the type of application. Its a bandpass filter for a TETRA
repeater. This channel would be switched at most once every week. So
it would be like switching the power off. Anyway , I really would like
to know
if it is necesary reseting signals.

Cheers
 
D

Dave Higton

In message
<4c75d645-8f8f-42a8-8dd2-12df14f4b30c@m34g2000hsb.googlegroups.com>
Alfreeeeed said:
Ok , so basically what I need to do is declare all my signals in an array
or if needed in record types so the reseting code for the signals would be
at most the number of arrays declared. Is that right?

I'm not sure I understand your statement. Normally there is just one
reset /signal/. It isn't a code, it's a single line. You can apply
it to as many or as few registers as you wish.
On the other hand, I am not sure if I really need to reset my signals if I
am changing coefficients. I believe I must to. Specially because of the
type of application. Its a bandpass filter for a TETRA repeater. This
channel would be switched at most once every week. So it would be like
switching the power off. Anyway , I really would like to know if it is
necesary reseting signals.

Only you can answer that. Ask yourself these two questions:

1) What will happen if I don't reset the filter registers?

2) What will happen if I do reset the filter registers?

When you have analysed the system thoroughly, you should be able
to decide which course of action is better.

Dave
 
A

Alfreeeeed

In message
<4c75d645-8f8f-42a8-8dd2-12df14f4b...@m34g2000hsb.googlegroups.com>



I'm not sure I understand your statement. Normally there is just one
reset /signal/. It isn't a code, it's a single line. You can apply
it to as many or as few registers as you wish.


Only you can answer that. Ask yourself these two questions:

1) What will happen if I don't reset the filter registers?

2) What will happen if I do reset the filter registers?

When you have analysed the system thoroughly, you should be able
to decide which course of action is better.

Dave

Ok , that is what I am going to do right now. I will declare all the
registers in arrays and reset just them.
Thanks
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top