Mod (%) Function in VHDL

K

Kwaj

Guest
Hi,

I am trying to implement an interleaver for an error-control design I am
working on. The interleaver employs the mod function and as such I am
wondering whether VHDL already has this function available?

I have been unable to find it thus far but was hoping that I didn't need to
write the function myself.

- Kwaj
 
On Thu, 15 Jan 2004 00:10:23 +1100, "Kwaj"
<k.oteng@NOSPAMstudent.unsw.edu.au> wrote:

Hi,

I am trying to implement an interleaver for an error-control design I am
working on. The interleaver employs the mod function and as such I am
wondering whether VHDL already has this function available?

I have been unable to find it thus far but was hoping that I didn't need to
write the function myself.
VHDL has mod and rem. They return the same thing if both arguments
are positive.

How hard did you look?

Regards,
Allan.
 
Look in your book at REM and MOD.


Kwaj wrote:

Hi,

I am trying to implement an interleaver for an error-control design I am
working on. The interleaver employs the mod function and as such I am
wondering whether VHDL already has this function available?

I have been unable to find it thus far but was hoping that I didn't need to
write the function myself.

- Kwaj
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
On Thu, 15 Jan 2004 01:12:08 +1100, Allan Herriman
<allan.herriman.hates.spam@ctam.com.au.invalid> wrote:

On Thu, 15 Jan 2004 00:10:23 +1100, "Kwaj"
k.oteng@NOSPAMstudent.unsw.edu.au> wrote:

Hi,

I am trying to implement an interleaver for an error-control design I am
working on. The interleaver employs the mod function and as such I am
wondering whether VHDL already has this function available?

I have been unable to find it thus far but was hoping that I didn't need to
write the function myself.

VHDL has mod and rem. They return the same thing if both arguments
are positive.
BTW, they produce different results for negative inputs:

5 mod 3 = 2
(-5) mod 3 = 1
5 mod (-3) = -1
(-5) mod (-3) = -2

whereas

5 rem 3 = 2
(-5) rem 3 = -2
5 rem (-3) = 2
(-5) rem (-3) = -2


Since '%' is in the subject...
IIRC, the C language doesn't actually define what % does with negative
arguments, and it's likely that the compiler will just use the
underlying machine mod operation (if one exists), so results may vary
from architecture to architecture (in keeping with the C spirit).


Regards,
Allan
 
cheers Allan. I honestly had not come across it in my reference. I guess
that leads me to another question - what's a concise reference for VHDL?
i.e. a book or URL which a lot of you guys use to look up commands?


"Allan Herriman" <allan.herriman.hates.spam@ctam.com.au.invalid> wrote in
message news:tuma001qrejj3tdd2q93mgn2qsvouuju8g@4ax.com...
On Thu, 15 Jan 2004 01:12:08 +1100, Allan Herriman
allan.herriman.hates.spam@ctam.com.au.invalid> wrote:

On Thu, 15 Jan 2004 00:10:23 +1100, "Kwaj"
k.oteng@NOSPAMstudent.unsw.edu.au> wrote:

Hi,

I am trying to implement an interleaver for an error-control design I am
working on. The interleaver employs the mod function and as such I am
wondering whether VHDL already has this function available?

I have been unable to find it thus far but was hoping that I didn't need
to
write the function myself.

VHDL has mod and rem. They return the same thing if both arguments
are positive.

BTW, they produce different results for negative inputs:

5 mod 3 = 2
(-5) mod 3 = 1
5 mod (-3) = -1
(-5) mod (-3) = -2

whereas

5 rem 3 = 2
(-5) rem 3 = -2
5 rem (-3) = 2
(-5) rem (-3) = -2


Since '%' is in the subject...
IIRC, the C language doesn't actually define what % does with negative
arguments, and it's likely that the compiler will just use the
underlying machine mod operation (if one exists), so results may vary
from architecture to architecture (in keeping with the C spirit).


Regards,
Allan
 
Kwaj schrieb:
cheers Allan. I honestly had not come across it in my reference. I guess
that leads me to another question - what's a concise reference for VHDL?
i.e. a book or URL which a lot of you guys use to look up commands?
One good place for VHDL Syntax is
http://www.amontec.com/fix/vhdl_memo/index.html

or follow some of the other links from

http://tech-www.informatik.uni-hamburg.de/vhdl/

Cheers,
Charles
 
On Thu, 15 Jan 2004 00:54:05 +0100, xxx@munich.netsurf.de wrote:

Kwaj schrieb:
cheers Allan. I honestly had not come across it in my reference. I guess
that leads me to another question - what's a concise reference for VHDL?
i.e. a book or URL which a lot of you guys use to look up commands?


One good place for VHDL Syntax is
http://www.amontec.com/fix/vhdl_memo/index.html

or follow some of the other links from

http://tech-www.informatik.uni-hamburg.de/vhdl/
I find the best concise syntax description is the set of Qualis Quick
Reference Cards. They don't describe semantics, but often a reminder
of the syntax is all that's required.

VHDL (you'll need both):
http://www.eda.org/rassp/vhdl/guidelines/vhdlqrc.pdf
http://www.eda.org/rassp/vhdl/guidelines/1164qrc.pdf

Verilog:
http://www.eda.org/rassp/vhdl/guidelines/vlogqrc.pdf

BTW, Qualis seems to have been swallowed by Synopsys.

Regards,
Allan.
 
Hi

I had somme troubles between excel equations and excel VBA which shows
differents results on negative numbers check

http://support.microsoft.com/default.aspx?kbid=214271

there is some explanation whihc can tell to go further in case you don't
want using already build functions

regards

jacky
--
Ce message a ete poste via la plateforme Web club-Internet.fr
This message has been posted by the Web platform club-Internet.fr

http://forums.club-internet.fr/
 

Welcome to EDABoard.com

Sponsor

Back
Top