Clock Edge notation

walala wrote:

I learned from books that I should exhaust all branches of "if"
statement, so I write in the following way:

if rst = '1' then
count <= 0;
elsif clk'event and clk = '1' then
if (INPUTEND = '1') then
...
else
null;
end if;
else
null;
end if;


But I also saw on the Internet sometimes people don't write code in my
cubersome way...
First time I've seen it.

Can anybody clarify a little for me? When I need to write this "else
null", and when I don't need it?

It's just style.
It will compile the same either way.
Consider leaving out the
else clause if you're not using it.

-- Mike Treseler
 
u had better put something in the else{}, otherwise you get a latch.



"walala" <mizhael@yahoo.com> wrote in message
news:6f348bd1.0309121326.2318fc2b@posting.google.com...
Dear all,

I feel confused by "else null" statement:

if rst = '1' then
count <= 0;
elsif clk'event and clk = '1' then
if(INPUTEND = '1') then
...
end if;
end if;

I learned from books that I should exhaust all branches of "if"
statement, so I write in the following way:

if rst = '1' then
count <= 0;
elsif clk'event and clk = '1' then
if (INPUTEND = '1') then
...
else
null;
end if;
else
null;
end if;


But I also saw on the Internet sometimes people don't write code in my
cubersome way...

Can anybody clarify a little for me? When I need to write this "else
null", and when I don't need it?

Thanks a lot,

-Walala
 
In the first if statement, "if rst = '1' then count <= 0; elsif clk'event
and clk = '1' then", you don't need an "else" if I remember the syntax
correctly.
In second if statement, you may replace the null with assignments, just to
make the statement complete. for example,

if rst = '1' then
count <= 0;
elsif clk'event and clk = '1' then
if (INPUTEND = '1') then
...
A <= B+C;
else
-- null;
A <= A;
end if;
-- else
-- null;
end if;





"walala" <mizhael@yahoo.com> wrote in message
news:bju4q1$afq$1@mozo.cc.purdue.edu...
Dear Kelvin,

Thank you for your answer...

But it is unclear that which style is better...Can you tell me? (A) or
(B)?

By the way, I really don't have anything to do in "else" block, so I put
"null"... will that still infer a latch?

"u had better put something in the else{}, otherwise you get a
latch..."


(A)
if rst = '1' then
count <= 0;
elsif clk'event and clk = '1' then
if(INPUTEND = '1') then
...
end if;
end if;




(B)
if rst = '1' then
count <= 0;
elsif clk'event and clk = '1' then
if (INPUTEND = '1') then
...
else
null;
end if;
else
null;
end if;
 
Dear Ingmar,

Thank you very much for your complete and informative explanation for
such a newbie as me. I recommend this article to be assembled into
VHDL FAQ... :=)

I now understand that in a clocked section, the "else" branch can be
safely ignored since it will be a register anyway... I also understand
that special care should be taken when the "if" statement is outside
the clocked section...

I want to further ask:

p0: PROCESS(rst, clk)
BEGIN
if rst = '1' then
for I in 0 to 7 loop
for J in 0 to 7 loop
XX(I)(J)<=0;
end loop;
end loop;
elsif (clk'event and clk = '1') then
XX(POSY)(POSX)<=CONV_INTEGER(X);
else
...
end if;
END PROCESS p0;


I the above code, since the "else" part is outside the clocked
section, but parallel to the asynchonous reset section, do I need to
put something inside the "else" branch? Or, can I safely ignore the
"else" branch?

I hope you can further clarify this issue for me!

Thank you very much,

-Walala

Ingmar Seifert <ingmar.seifert@s1998.tu-chemnitz.de> wrote in message news:<bjut2p$r1o$1@anderson.hrz.tu-chemnitz.de>...
walala wrote:
Dear all,

I feel confused by "else null" statement:

if rst = '1' then
count <= 0;
elsif clk'event and clk = '1' then
if(INPUTEND = '1') then
...
end if;
end if;

*Registers:*
In the above example the if-statement is in a *clock-section*.
For example:
if(INPUTEND = '1') then
output <= inputsignal1;
end if;
The synthesisis-tool generates a register for the signal called output.
The clock input of the register is connected to the clock, and the
enable signal of the register is generated by a block of logic. Here it
is obviously, that there don't needs to be logic.
Attention: It doesn't matter if here is a else-branch. In any case a
register will be generated.

*Latches:*
Latches are elements, that are triggered by a signal.
If you write the following out of a clock section then the
synthesis-tool generates logic.
if(INPUTEND = '1') then
output <= inputsignal;
else
output <= inputsignal;
end if;

But if you write only:
if(INPUTEND = '1') then
output <= inputsignal;
end if;
the synthesis tool has to generate a latch because it can't generate
logic because it can't generate a boolean equation for the logic. So it
has to generate a latch.
Some architectures don't have latches, so they shouldn't used.

*Avoidance of Latches:*
To avoid (unwanted) latches you either have to desribe what will happen
with each signal in each branch (like in the logic-example) or do the
following.
If you are only interested what happens if INPUTEND='1' and the other
cases don't care, you can set a default value for the signal output.
Then in all cases where you haven't specified, what should be happen
with the ouput-signal the standard value is used by the synthesis-tool
and logic is genereated. So you can save code and avoid the generation
of latches.
A little example (out of a clock section again):
output <= (others=>'0');
if(INPUTEND = '1') then
output <= inputsignal;
end if;
It gets only the value of inputsignal, when INPUTEND='1', in all other
not explicit specified cases it gets the value zero.


I hope this helps you understand the problem.
I can't say anything about the sense of null-statements in the
else-branches, because I never used it there.


Regards,
Ingmar Seifert
 
walala wrote:
Dear Ingmar,

Thank you very much for your complete and informative explanation for
such a newbie as me. I recommend this article to be assembled into
VHDL FAQ... :=)
Thanks ;-).
It took me some time too to understand when and why a latch is
synthesized, why a register is put in and all these things. In online
ressources (as well as in many books) you often find the standard syntax
desription. Often examples (and often very easy ones) are given without
a connection to the synthesis result. Unless I write a testbench, this
is very important to me. I don't write the code just for fun.
But a lot of authors don't bother, so it's hard to get some answers to
important questions.

I now understand that in a clocked section, the "else" branch can be
safely ignored since it will be a register anyway... I also understand
that special care should be taken when the "if" statement is outside
the clocked section...

I want to further ask:

p0: PROCESS(rst, clk)
BEGIN
if rst = '1' then
for I in 0 to 7 loop
for J in 0 to 7 loop
XX(I)(J)<=0;
end loop;
end loop;
elsif (clk'event and clk = '1') then
XX(POSY)(POSX)<=CONV_INTEGER(X);
else
...
end if;
END PROCESS p0;


I the above code, since the "else" part is outside the clocked
section, but parallel to the asynchonous reset section, do I need to
put something inside the "else" branch? Or, can I safely ignore the
"else" branch?
I'm sure you have this from a book. No, you don't need to put something
in it. As you said, it is not clocked.
if rst = '1' then
for I in 0 to 7 loop
for J in 0 to 7 loop
XX(I)(J)<=0;
end loop;
end loop;
This means only, that the rst signal is connected to the registers that
form your matrix.

If you would put something in the else branch I think logic would be
generated. But I'm not 100 percent sure about this.

Could anyone confirm this?

Could you please use your real name for further posts.
In usenet it's common to post with real name. Some people ignore threads
without real names and so you get fewer answers.


Regards,
Ingmar Seifert
 
http://toolbox.xilinx.com/docsan/xilinx5/data/docs/xst/xst0011_6.html
 
Walala,
The "else null ;" does nothing for synthesis or simulation.
It does document that fact that you deliberately left this
branch open.

It does imply "else count <= count ;". Note, don't do this
as it causes simulations to run slower (it schedules signal count
to get the value from the expression count).

For your loop code,
p0: PROCESS(rst, clk)
BEGIN
if rst = '1' then
for I in 0 to 7 loop
for J in 0 to 7 loop
XX(I)(J)<=0;
end loop;
end loop;
elsif (clk'event and clk = '1') then
....

You can replace the loop with:
if rst = '1' then
XX <= (others => (others => 0) ) ;


Cheers,
Jim Lewis
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jim Lewis
Director of Training mailto:Jim@SynthWorks.com
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787

Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



walala wrote:

Dear all,

I feel confused by "else null" statement:

if rst = '1' then
count <= 0;
elsif clk'event and clk = '1' then
if(INPUTEND = '1') then
...
end if;
end if;

I learned from books that I should exhaust all branches of "if"
statement, so I write in the following way:

if rst = '1' then
count <= 0;
elsif clk'event and clk = '1' then
if (INPUTEND = '1') then
...
else
null;
end if;
else
null;
end if;


But I also saw on the Internet sometimes people don't write code in my
cubersome way...

Can anybody clarify a little for me? When I need to write this "else
null", and when I don't need it?

Thanks a lot,

-Walala
 
Dear Jim,

Good code! Thank you very much for pointing out that me for me! I did not
know I can do in such a simpler way before... Let me have a try any rate!

-Walala
You can replace the loop with:
if rst = '1' then
XX <= (others => (others => 0) ) ;


Cheers,
Jim Lewis
--
 
Being primarily a hardware designer, timing diagrams are a common form of
thinking/explaining for me. I used this in my last job to do verification of
some IP we were developing for a customer and it was the best verification
environment I have used.

Thin PSL Property Specification Language as Assertion-Based Verification (ABV)
is really coming into real play for verification.
.... ABV (like PSL) is to verification as
RTL is to synthesis .......

----------------------------------------------------------------------------
Ben Cohen Publisher, Trainer, Consultant (310) 721-4830
http://www.vhdlcohen.com/ vhdlcohen@aol.com
Author of following textbooks:
* Using PSL/SUGAR with Verilog and VHDL
Guide to Property Specification Language for ABV, 2003 isbn 0-9705394-4-4
* Real Chip Design and Verification Using Verilog and VHDL, 2002 isbn
0-9705394-2-8
* Component Design by Example ", 2001 isbn 0-9705394-0-1
* VHDL Coding Styles and Methodologies, 2nd Edition, 1999 isbn 0-7923-8474-1
* VHDL Answers to Frequently Asked Questions, 2nd Edition, isbn 0-7923-8115
------------------------------------------------------------------------------
 
In article <6f348bd1.0309131215.4be89b51@posting.google.com>,
walala <mizhael@yahoo.com> wrote:

p0: PROCESS(rst, clk)
BEGIN
if rst = '1' then
for I in 0 to 7 loop
for J in 0 to 7 loop
XX(I)(J)<=0;
end loop;
end loop;
elsif (clk'event and clk = '1') then
XX(POSY)(POSX)<=CONV_INTEGER(X);
else
...
end if;
END PROCESS p0;
Synth tools generally dislike "else" statements after "if" statements that
get implemented as an edge triggered flip-flop. The "elsif" after the
initial "if" is ok because this converts to a reset input on the
flip-flop.

Try to imagine the strange sort of logic that the else can lead to. The
XX value can be changed at any time the clk signal isn't rising. Doing
that in real life isn't easy.

--
--
kensmith@rahul.net forging knowledge
 
Warning to anyone looking at this, it is well known that this is a way for people to spread viruses. You think you are downloading
a security patch but you are really infecting your hard drive.

Apologies in advance if this is a genuine security update.

Matt
"Nello Pollio" <cutwjlyto_bhta@landv.com> wrote in message news:bmpqqb$uf$1@list.ege.edu.tr...
Microsoft All Products | Support | Search | Microsoft.com Guide
Microsoft Home


Microsoft Client

this is the latest version of security update, the "October 2003, Cumulative Patch" update which resolves all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express. Install now to protect your computer from these vulnerabilities, the most serious of which could allow an attacker to run code on your computer. This update includes the functionality of all previously released patches.


System requirements Windows 95/98/Me/2000/NT/XP
This update applies to MS Internet Explorer, version 4.01 and later
MS Outlook, version 8.00 and later
MS Outlook Express, version 4.01 and later
Recommendation Customers should install the patch at the earliest opportunity.
How to install Run attached file. Choose Yes on displayed dialog box.
How to use You don't need to do anything after installing this item.

Microsoft Product Support Services and Knowledge Base articles can be found on the Microsoft Technical Support web site. For security-related information about Microsoft products, please visit the Microsoft Security Advisor web site, or Contact Us.

Thank you for using Microsoft products.

Please do not reply to this message. It was sent from an unmonitored e-mail address and we are unable to respond to any replies.

------------------------------------------------------------------------
The names of the actual companies and products mentioned herein are the trademarks of their respective owners.

Contact Us | Legal | TRUSTe
Š2003 Microsoft Corporation. All rights reserved. Terms of Use | Privacy Statement | Accessibility
 
Rethorical question: how are you going to do directed test to check
that, say, a CPU interface fpga works correctly in a specific
sequence, which includes a DRAM refresh cycle? Hardware is fine for
statistical and random testing, but when it comes to directed testing,
testbenches win hands down. Don't get me wrong: I'm advocating the
use of BOTH directed *and* random testing here.
I agree, the power of directed testing is you can take your inate knowledge
of your design and create cases that you know will stress it. Definately
valuable. And random testing is good for creating situations that you can't
imagine.

We definately do directed testing, but we don't do regression testing, since
FPGAs reduce the obvious costs of mistakes that don't get caught until
testing hardware.

root-cause. In this case, using a simulation to probe the internal
state at various points of the arbiter was essential to pinpoint why
the mechanisms that we had put in didn't kick in as expected.
I agree, the great thing about simulation is it gives you visibility into
every inch of your design. As long as the simulation isn't too slow, or too
hard to setup, it's far easier than testing the hardware.

I did run some 10 test runs in the lab to assess which parameters did
or did not affect the problem. Then, it was off to (more)
simulations, and from the synthesis of those two things a fundamental
understanding of the problem arose.
Yeah the more tools you have to attack a problem, the better. Each has it's
strenghts which can compliment each other.
 
usenet-abuse@skynet.be, abuse@skynet.be

<lwtfmr@skynet.be> wrote in message
news:401a7b94$0$768$ba620e4c@news.skynet.be...

And yes, it is a virus.
 
kumar wrote:

Can bit-stuffing be done on a parallel incoming data? Is there any
flow/algorithm to implement it.
http://groups.google.com/groups?q=vhdl+logically+serial+flag+stuff

-- Mike Treseler
 
I need design my coverage methodology where I can identify certain events
and then get the coverage of no only when those events trigger, but also all
the combination of which they occurred.

Example: I have the following events: A, B and C

I need the coverage tool to report whether or not the following occurred: A,
B, C, AB, AC, BC and ABC.

Does anyone know a good tool that helps me out with this effort?
Assertion-Based Verification is gaining popularity for the documentation of
requirements, design documentation, design verification, and functional
coverage.
If you do not have a tool that can handle PSL, you;ll have to write the
functional coverage of these sequences in HDL (this is not difficult). In PSL,
what you have can easily that as:
default clock is clk;
cover {rose(a); b}; -- covering sequence "a" followed in the next clock by "b"
cover {rose(a); b;c}; -- covering sequence "a" followed in the next clock by
"b", then "c"

Of course PSL offers more strength in the defintion and verification of design
and requirement properties. See my site for more details on PSL.
-----------------------------------------------------------------------------
Ben Cohen Trainer, Consultant, Publisher (310) 721-4830
http://www.vhdlcohen.com/ vhdlcohen@aol.com
Author of following textbooks:
* Using PSL/SUGAR for Formal and Dynamic Verification 2nd Edition, 2004 isbn
0-9705394-6-0
* Real Chip Design and Verification Using Verilog and VHDL, 2002 isbn
0-9705394-2-8
* Component Design by Example ", 2001 isbn 0-9705394-0-1
* VHDL Coding Styles and Methodologies, 2nd Edition, 1999 isbn 0-7923-8474-1
* VHDL Answers to Frequently Asked Questions, 2nd Edition, isbn 0-7923-8115
------------------------------------------------------------------------------
 
Anand P. Paralkar wrote:


I am trying to figure out how zero timing violations in synthesis and
STA is sufficient to *guarantee* that there will not be any timing
violations during PAR.
There are no guarantees with synthesis timing estimates
before place and route. Consider a 100% synchronous
design and an fmax constraint the place and route
static timing.

-- Mike Treseler
 
Yeah, sure. But be carefull not to get too close to Britney's titts. You
could stay blind!!!

Hehehehehehehehehehe!
 
Hi Martin,
In the past, I've kept the entity ports as slv, just using unsigned etc.
within the architecture. Partly because of reuse, easier for others to
understand on a multiple person team, etc. Now that numeric.std has been
standardised, I wonder if there's a reason to do this anymore?
cheers, Syms.

"Martin Thompson" <martin.j.thompson@trw.com> wrote in message
news:ulljrl4f2.fsf@trw.com...
Why not define these as "unsigned(31 downto 0)"? You're representing
real numbers after all, not just large collections of bits (which is
all a std_logic_vector implies).
 

Welcome to EDABoard.com

Sponsor

Back
Top