Is this kind of writing useful?

Discussion in 'VHDL' started by fl, Mar 2, 2013.

  1. fl

    fl Guest

    I get the following VHDL code from Matlab HDL coder, in which enb_1_1_1 always is '1' from its input. I find the process to write dbfout1_re_tmp value while out of the process the reverse is written to dbfout1_re.

    What do you think of this writing style? Is it an acceptable even for a hand writing code? Is there any other better writing style?


    temp_process26_Delay_butterfly1 : PROCESS (clk, reset)
    IF reset = '1' THEN
    dbfout1_re_tmp <= (OTHERS => '0');
    dbfout1_im_tmp <= (OTHERS => '0');
    ELSIF clk'event AND clk = '1' THEN
    IF enb_1_1_1 = '1' THEN
    dbfout1_re_tmp <= bfout1_re;
    dbfout1_im_tmp <= bfout1_im;
    END IF;
    END IF;
    END PROCESS temp_process26_Delay_butterfly1;

    dbfout1_re <= std_logic_vector(dbfout1_re_tmp);
    dbfout1_im <= std_logic_vector(dbfout1_im_tmp);
    fl, Mar 2, 2013
    1. Advertisements

  2. fl

    Tricky Guest

    HDL Coder produces usable but crap to read code.
    It works ok, but I wouldnt wasnt to read it. God forbid you have to modify it by hand.

    But then you're not supposed to modify it by hand. You're supposed to modify the top level file. THe problem with this is, if you add more blocks or rename anything, you have to manually remove the old filenames and add in the 100s of new files HDL crapper generates (unless you can script it up - but HDL coder used to have a nice bug where it wouldnt generate any other TCLthan the deafult - no matter what you put in the "script output box".

    Can you tell I try and avoid HDL coder whenever possible?
    Tricky, Mar 4, 2013
    1. Advertisements

  3. fl

    Andy Guest

    This style may have to do with the generator not being aware of whether the_tmp signal is read back in the process, while the final signal may be a port of mode out (and therefore not readable under pre-2008 VHDL).

    I would not recommend this style in hand written code unless the value driving the output port needs to also be read (e.g. for feedback).

    I also noticed the type convertion in the final assignments. This may also be part of the reason the generator created this style of code.

    In general, there are very few style elements of machine-generated vhdl that I would consider desirable for human-written code.

    Andy, Mar 4, 2013
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.