[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [f-cpu] HDL coding rules



Hi,

Yann Guidon wrote:

>hello,
>
>Just an Illusion wrote:
>
>>Hello,
>>
>>After a private disussion between different member of the f-cpu list, we
>>have arrive to conclude than no coding rules exist on the project.
>>
>
>???
>
>that's wrong.
>
>or maybe you mixed "coding style" and "coding rule" which in our context
>are the same thing.
>
I go try to clarify my mind.
"coding style" and "coding rule" are not same (in any context).

If you said : all my signal must be postfixed with the entity name, this 
is a "coding rule" not a "coding style".

If you said : all my state machine must be mealy-like, this is a "coding 
style" not a "coding rule".

>
>
>And in case you want to start a new unit, just copy/paste an existing
>one and modify the necessary parts, while keeping the same look.
>
>btw, i looked once at the LEON code and i think it's easier to use
>F-CPU's sources. It's probably a bit confusing, but not confused.
>
>>This point seems not very important as long as the number of coder is
>>small, but to help newbies or modification of existing block, the coding
>>rule usage is better.
>>
>The use of a brain (and optionally : good sense) is ok, too.
>
>>The existance of coding rule, can be help to understand the code of a
>>bloc and the hierarchical structure.
>>
>>We made some proposal :
>>      * hierarchical prefix on each signal (and interface pad) to give
>>hierarchical belonging
>>      * postfix on each signal to give signal direction or polarity,
>>like _i (input), _o(output), _s(internal signal), _n(not signal)...
>>      * file name rule
>>      * don't use signal declaration into package declaration.
>>
>>If you see other rules, propose them.
>>
>
>maybe you can look at the code and see yourself.
>
Ok, I have done it.

Please, Etienne forgive me, but your code can be a good example to 
illustrated this subject.

In the eu_inc.vhd file :

* some keywords are in capital letter, some others not.
* The generic parameter eu_inc_width can be put in capital letter, to 
help distinction with signal and variable value.
* The interface signals aren't globally in capital letter except for 
function  abs_chunk.

That doesn't change the result, but can help the code reading.

The next remark is not a "coding rule", but more a "coding style" rule.

I thing is better if you create a package which embedded all the 
necessary component (and perhaps functions) needed for your eu_inc and 
eu_cmp rather than "use work.find_lsb;" notation.

>
>>Cheers,
>>Just an Illusion
>>
>WHYGEE
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>*************************************************************
>To unsubscribe, send an e-mail to majordomo@seul.org with
>unsubscribe f-cpu       in the body. http://f-cpu.seul.org/
>
Just an Illusion

-- 
______________________________
"The matrix is my world, I am a shadow.
Shadow in world, shadow in life. Don't try to keep me,
I am a Corpo's Killer.
Don't follow me or die..."
		The KingWalker - 1996



*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/