Clocking inside an overloaded function

Discussion in 'VHDL' started by vhdl@algonordic.dk, Jun 16, 2006.

  1. 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 ?
    , Jun 16, 2006
    #1
    1. Advertising

  2. 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.
    David R Brooks, Jun 17, 2006
    #2
    1. Advertising

  3. 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
    Ralf Hildebrandt, Jun 17, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Yves Tchapda

    Boundary scan clocking

    Yves Tchapda, Sep 17, 2003, in forum: VHDL
    Replies:
    0
    Views:
    542
    Yves Tchapda
    Sep 17, 2003
  2. Ralf Hildebrandt

    clocking on a variable

    Ralf Hildebrandt, Jun 19, 2004, in forum: VHDL
    Replies:
    0
    Views:
    445
    Ralf Hildebrandt
    Jun 19, 2004
  3. Replies:
    1
    Views:
    826
  4. Clocking proccesses' time

    , Nov 27, 2005, in forum: C Programming
    Replies:
    3
    Views:
    321
  5. clocking subprocesses

    , Mar 3, 2008, in forum: Python
    Replies:
    4
    Views:
    360
    Karthik Gurusamy
    Mar 4, 2008
Loading...

Share This Page