Clocking inside an overloaded function

Guest
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 ?
 
vhdl@algonordic.dk 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.
 
vhdl@algonordic.dk 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
 

Welcome to EDABoard.com

Sponsor

Back
Top