FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > FPGA

FPGA comp.arch.fpga newsgroup (usenet)

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-04-2006, 10:49 AM
Jan Decaluwe
Guest
 
Posts: n/a
Default Cordic-based Sine Computer in MyHDL

Hi:

I have added a page about a Cordic-based Sine Computer to
the MyHDL CookBook:

http://myhdl.jandecaluwe.com/doku.php/cookbook:sinecomp

This page demonstrates several features of the MyHDL to Verilog
convertor tool. In particular:

- it shows how the convertor takes care of the tricky issues
with negative numbers in Verilog automatically
- it shows how you can use non-synthesizable constructs in MyHDL
and still get synthesizable Verilog out of it :-) (Really!)

Regards,

Jan

--
Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com
Losbergenlaan 16, B-3010 Leuven, Belgium
From Python to silicon:
http://myhdl.jandecaluwe.com
Reply With Quote
  #2 (permalink)  
Old 05-04-2006, 10:58 AM
Kolja Sulimma
Guest
 
Posts: n/a
Default Re: Cordic-based Sine Computer in MyHDL

Jan Decaluwe schrieb:
> - it shows how you can use non-synthesizable constructs in MyHDL
> and still get synthesizable Verilog out of it :-) (Really!)


I heard a research talk on a GI workshop that talked about using simple
XSLT translations to make common unsynthesizable VHDL code synthesizable.

IMHO it is embarrassing that a 2006 compiler cannot synthesize

if rising_edge(clk) and enable='1' then...

Kolja Sulimma
Reply With Quote
  #3 (permalink)  
Old 05-04-2006, 12:16 PM
Symon
Guest
 
Posts: n/a
Default Re: Cordic-based Sine Computer in MyHDL

"Kolja Sulimma" <[email protected]> wrote in message
news:[email protected]
>
> IMHO it is embarrassing that a 2006 compiler cannot synthesize
>
> if rising_edge(clk) and enable='1' then...
>

Hi Kolja,
Just out of curiosity, which compiler are you talking about? XST? Synplify
seems fine, I do get a "Feedback mux created for signal xxxxx" warning, but
the output doesn't have this mux. Thanks.
Cheers, Syms.



Reply With Quote
  #4 (permalink)  
Old 05-04-2006, 01:32 PM
Kolja Sulimma
Guest
 
Posts: n/a
Default Re: Cordic-based Sine Computer in MyHDL

Symon schrieb:
> "Kolja Sulimma" <[email protected]> wrote in message
> news:[email protected]
>
>>IMHO it is embarrassing that a 2006 compiler cannot synthesize
>>
>>if rising_edge(clk) and enable='1' then...
>>

>
> Hi Kolja,
> Just out of curiosity, which compiler are you talking about? XST? Synplify
> seems fine, I do get a "Feedback mux created for signal xxxxx" warning, but
> the output doesn't have this mux. Thanks.
> Cheers, Syms.


I never used synplify, but it is plausible that it has a more modern
view on what should be synthesizable and what should not, as the company
was started at a time where people allready complained about such
limitations.

I discovered limitations like these in the last couple of years in
Synopsys FPGA Compiler as well as Design Compiler, in Magma DAs Blast
RTL and in XST.

IMHO the worst limitation was a version ov Blast RTL that restricted
generics to be of type integer. My code used to turn on feature with
boolean values. No it uses integers...

Kolja Sulimma


Reply With Quote
  #5 (permalink)  
Old 05-04-2006, 06:26 PM
Mike Treseler
Guest
 
Posts: n/a
Default Re: Cordic-based Sine Computer in MyHDL

Jan Decaluwe wrote:

> I have added a page about a Cordic-based Sine Computer to
> the MyHDL CookBook:
>
> http://myhdl.jandecaluwe.com/doku.php/cookbook:sinecomp


Wow. A non-trivial example that works.
Beautiful generated code.
(Ignore the synthesis warnings, I think Jan has it right.)
You may be on to something.

Here's how Quartus sees it:
http://home.comcast.net/~mike_treseler/sinecomputer.pdf
_______________________
Top-level Entity Name : SineComputer
Family : Stratix II
Device : EP2S15F484C3
Timing Models : Final
Total ALUTs : 276 / 12,480 ( 2 % )
Total registers : 107
[vs. 131 in the example -- apples to oranges ]
Actual Time : 141.42 MHz ( period = 7.071 ns )
[ vs 87.385MHz in the example -- apples to oranges ]


-- Mike Treseler
Reply With Quote
  #6 (permalink)  
Old 05-04-2006, 07:51 PM
Mike Treseler
Guest
 
Posts: n/a
Default Re: Cordic-based Sine Computer in MyHDL

Kolja Sulimma wrote:

>>> IMHO it is embarrassing that a 2006 compiler cannot synthesize
>>> if rising_edge(clk) and enable='1' then...


I don't know of a recent release that causes such embarrassment.
The example below works fine on Quartus.
The downside to this template is that it clock enables
everything in the process -- too restrictive for me.

-- Mike Treseler

___________________________
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity clk_en is
generic (vec_len : positive := 8);
port (
clk : in std_ulogic;
reset : in std_ulogic;
enable : in std_ulogic;
q : out std_logic_vector(vec_len-1 downto 0)
);
end entity clk_en;

architecture synth of clk_en is
begin
clk_en : process(reset, clk) is
subtype vec_t is unsigned(vec_len-1 downto 0);
constant vec_init : vec_t := "10110011";
variable reg_v : vec_t;
begin -- process template
if reset = '1' then
init_regs : reg_v := vec_init;
elsif rising_edge(clk) and enable = '1' then --<
update_regs : reg_v := rotate_left(reg_v, 1);
end if;
update_ports : q <= std_logic_vector(reg_v);
end process clk_en;
end architecture synth;


Reply With Quote
  #7 (permalink)  
Old 05-04-2006, 08:56 PM
Symon
Guest
 
Posts: n/a
Default Re: Cordic-based Sine Computer in MyHDL

"Mike Treseler" <[email protected]> wrote in message
news:[email protected]
>
> The downside to this template is that it clock enables
> everything in the process -- too restrictive for me.
>

Hi Mike,
I try to make sure every process (and, of course, every entity) has an
enable. Even if the enable is set to '1' in the code, it makes it a lot
easier to reuse in future designs with faster clocks.
Sadly, I don't always remember to do this. :-(
Cheers, Syms.
p.s. Jan, sorry for wandering off topic!


Reply With Quote
  #8 (permalink)  
Old 05-05-2006, 10:50 AM
Jan Decaluwe
Guest
 
Posts: n/a
Default Re: Cordic-based Sine Computer in MyHDL

Mike Treseler wrote:
> Jan Decaluwe wrote:
>
>> I have added a page about a Cordic-based Sine Computer to
>> the MyHDL CookBook:
>>
>> http://myhdl.jandecaluwe.com/doku.php/cookbook:sinecomp

>
>
> Wow. A non-trivial example that works.
> Beautiful generated code.
> (Ignore the synthesis warnings, I think Jan has it right.)


Does Quartus issue warnings also?

No doubt the warnings are related to the use of blocking
assignments in a clocked always block. You know :-)

At least XST doesn't declare this an error. My worst nightmare
would be that half-baked synthesis tools or Verilog gurus
would prevent me from writing code like this. It's a realistic
possibility that explains my occasional angry outbursts.

What I think happens is that XST creates a FF for any reg
in the code. When it detects that the Q output is not used,
it issues a warning. Fine with me, as long as it uses
the D input wire properly :-)

An interesting side effect is that no warnings are issued
in the more "advanced" case when a reg is potentially
used immediately but also stored for later usage,
like the 'counting' flag in this example:

http://myhdl.jandecaluwe.com/doku.ph...book:stopwatch

Best regards,

Jan

--
Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com
Losbergenlaan 16, B-3010 Leuven, Belgium
From Python to silicon:
http://myhdl.jandecaluwe.com
Reply With Quote
  #9 (permalink)  
Old 05-05-2006, 04:59 PM
Mike Treseler
Guest
 
Posts: n/a
Default Re: Cordic-based Sine Computer in MyHDL

Jan Decaluwe wrote:

> Does Quartus issue warnings also?
> No doubt the warnings are related to the use of blocking
> assignments in a clocked always block. You know :-)


Yes, and the warning isn't even apropos in this case since
you've gone belt-and-suspenders with a single named block
and local declarations for every reg appearing left of an '='.
I will check if I there is some way to stifle the warning.

> At least XST doesn't declare this an error.


I knew XST had to be better at something

> My worst nightmare
> would be that half-baked synthesis tools or Verilog gurus
> would prevent me from writing code like this. It's a realistic
> possibility that explains my occasional angry outbursts.


The tools have always allowed it,
and I suspect that a silent majority
of serious designers have used the
style without making a big deal of it.
There will always be quiet producers
and noisy lint-pickers.

> What I think happens is that XST creates a FF for any reg
> in the code. When it detects that the Q output is not used,
> it issues a warning. Fine with me, as long as it uses
> the D input wire properly :-)


Synthesis really has to do this anyway
because wasting flops is a mortal sin.

> An interesting side effect is that no warnings are issued
> in the more "advanced" case when a reg is potentially
> used immediately but also stored for later usage,
> like the 'counting' flag in this example:
>
> http://myhdl.jandecaluwe.com/doku.ph...book:stopwatch


Yes, synthesis is very clever.
Every variable-reg update gets
its own little "instance" of gates.

Keep up the good work and
don't let the b^st^rds get you down.
If I have to learn a new trick,
I think I would prefer python to systemverilog.

-- Mike Treseler
Reply With Quote
  #10 (permalink)  
Old 05-26-2006, 07:28 AM
Guest
 
Posts: n/a
Default Re: Cordic-based Sine Computer in MyHDL

you can add also:

CORDIC Bibliography Site :
http://web.archive.org/web/200010171...ce.utexas.edu/

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cordic-based Sine Computer in MyHDL Jan Decaluwe Verilog 5 05-26-2006 07:28 AM
Cordic v2.0 : cordic translate algorithm problem Tobias FPGA 0 12-22-2005 12:07 PM
Please Help: Verilog Computer based training course Tools License [email protected] Verilog 0 09-13-2005 04:36 AM
Please Help:Modelsim-Altera License "Verilog Computer Based training course" [email protected] FPGA 0 09-13-2005 04:32 AM
Bazix introduce FPGA based One Chip computer system Sander Zuidema FPGA 5 07-12-2005 05:48 PM


All times are GMT +1. The time now is 07:53 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved