Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Clocking inside an overloaded function

Reply
Thread Tools

Clocking inside an overloaded function

 
 
vhdl@algonordic.dk
Guest
Posts: n/a
 
      06-16-2006
Probably a simple issue again, but ...
We are trying to make a process execute vector additions and
multiplications etc., like

Q <= A + B;
Z <= D * E;

and want to stick to this simple notation (C-like) and not use
range-indicators or other details. Just the plain identifiers and
operators This makes a lot of logic, and because we dont have much
timing issues, the functions should ideally be broken down into shifts
and additions etc. Implementing especially the multiplication as a
bit-wise clocked function would be nice.

When implementing a function, fx. for addition like

impure function "+" (a, b : in my_t) return my_t is ... end function
"+";

we cannot seem to get it to work bit-wise. Is there any way of having a
CLOCK'EVENT work inside a function and only return after a number of
clocks, ie. after all bits have been manipulated ?

 
Reply With Quote
 
 
 
 
David R Brooks
Guest
Posts: n/a
 
      06-17-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Probably a simple issue again, but ...
> We are trying to make a process execute vector additions and
> multiplications etc., like
>
> Q <= A + B;
> Z <= D * E;
>
> and want to stick to this simple notation (C-like) and not use
> range-indicators or other details. Just the plain identifiers and
> operators This makes a lot of logic, and because we dont have much
> timing issues, the functions should ideally be broken down into shifts
> and additions etc. Implementing especially the multiplication as a
> bit-wise clocked function would be nice.
>
> When implementing a function, fx. for addition like
>
> impure function "+" (a, b : in my_t) return my_t is ... end function
> "+";
>
> we cannot seem to get it to work bit-wise. Is there any way of having a
> CLOCK'EVENT work inside a function and only return after a number of
> clocks, ie. after all bits have been manipulated ?
>

Functions are *defined* to be clockless: they execute in (notionally)
zero time.
You can do it with a procedure, but that can't overload an operator.
 
Reply With Quote
 
 
 
 
Ralf Hildebrandt
Guest
Posts: n/a
 
      06-17-2006
(E-Mail Removed) wrote:

> We are trying to make a process execute vector additions and
> multiplications etc., like
>
> Q <= A + B;
> Z <= D * E;
>
> and want to stick to this simple notation (C-like) and not use
> range-indicators or other details.


These are just descriptions of plain combinational logic.


> Just the plain identifiers and
> operators This makes a lot of logic, and because we dont have much
> timing issues, the functions should ideally be broken down into shifts
> and additions etc. Implementing especially the multiplication as a
> bit-wise clocked function would be nice.


You have to break it manually and model it in detail.


> When implementing a function, fx. for addition like
>
> impure function "+" (a, b : in my_t) return my_t is ... end function
> "+";
>
> we cannot seem to get it to work bit-wise.


It is not intended to do so.


> Is there any way of having a
> CLOCK'EVENT work inside a function and only return after a number of
> clocks, ie. after all bits have been manipulated ?


The methodology is: Build something, that is synchronous to an 'event
and from there call a function if you want.

res2<=std_ulogic_vector( unsigned(A) + unsigned(B) );

process(reset,clock)
begin
if (reset='1') then
res1_ff<=(others=>'0');
elsif rising_edge(clock) then
res1_ff<=std_ulogic_vector( unsigned(A) + unsigned(B) );
-- this is just a parallel adder (pure combinational),
-- that's output is sampled at the rising_edge(clock)
res2_ff<=res2;
-- that is exactly the same (look to where res2 is written)
end if;
end process;

Ralf
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clocking multiple MFT E1 G703 cards? bob@bfisk.demon.co.uk Cisco 2 12-31-2005 06:18 PM
clocking on a variable Ralf Hildebrandt VHDL 0 06-19-2004 08:17 AM
Re: VWIC-2MFT-T1 card and clocking Henry Yen Cisco 0 04-14-2004 11:01 PM
Cisco MC3810 T1 clocking problem Ed M Cisco 3 11-04-2003 04:46 PM
Boundary scan clocking Yves Tchapda VHDL 0 09-17-2003 04:32 PM



Advertisments