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

Re: [f-cpu] HDL coding rules



On Tue, Jul 30, 2002 at 01:58:29PM +0200, Just an Illusion wrote:
[...]
> I have an other one (coding style) :
> 
> Defined each value of eu_inc_mode by a constant, and use them into the 
> case structure. Something like :
> ...
> architecture simple of eu_inc is
> ...
>  constant C_EU_INC_MODE_NEG  : natural := "000"
>  constant C_EU_INC_MODE_DEC   : natural := "001"
>  constant C_EU_INC_MODE_INC    : natural := "010"
>  constant C_EU_INC_MODE_ABS   : natural := "011"
>  constant C_EU_INC_MODE_LSB0 : natural := "100"
>  constant C_EU_INC_MODE_LSB1 : natural := "101"

No wait... binary encoded mode vectors are a bad idea - they may force
the synthesizer to add unnecessary encoding and decoding circuits.
I usually pass opcode selection and mode bits unencoded (or one-hot
encoded if it makes sense - as in this case).

The general idea is to send the `flags' portion of the instruction word
directly to the EU and let the EU pick the appropriate bits (the size
bits are handled separately because they need a table lookup). The opcode
is decoded once inside IF/ID, and the result is sent to the EUs.

NB: If you define constants that are going to be used in an entity
interface, it doesn't make sense to define them inside the architecture
body (where they are invisible). Better put them in a package.

-- 
 Michael "Tired" Riepe <Michael.Riepe@stud.uni-hannover.de>
 "All I wanna do is have a little fun before I die"
*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/