KCL wrote:
> Is there any hazard to mix synchronous and asynchronous reset?
> I am making an RS232 controller and I generally use asynchronous reset in my
> design except in a process that serve to load the control word (indicate
> speed, data length, parity...) where I load the control word when reset =
> '1' or ctr_load ='1' , like that it load the control word at every reset and
> when we ask to reload it by ctrl_load
>
> Regards
>
> Alexis
>
> my code :
>
> decodeur : process(clk,rst)
> begin
>
> if rising_edge(clk) then
> if ctl_load='1' or rst='1' then
Note : the sensitivity list is incorrect : rst should be removed.
Are you sure you want/need to load an input or a register during a reset ?
If ctl_word is internal (registers) as I suspect, why not load asynchronously the
same default value as these registers ? (like from a package)
Are you sure you want/neet to give these registers a special treatment if the rest of
your design has an asynchronous reset ?
Mixing both sync and async reset may (according to the
FPGA technology and whether
your reset will use a global or not) not be a good idea. Synchronous reset means
reset will be part of your datapath. It may then add a logic level which isn't always
welcome. You may also prevent some tools from dissolve your global reset if you don't
use it. And you force static timing into analyzing your reset within fmax/Tsu/Th...
Can you explain why you need mixing both and what functionality it allows that not
mixing would prevent ?
btw : the divider decoding might be expressed in a simpler way.
Like in this example (dtmf coder):
------
-- Fclock is a generic parameter = 60E6 for Tornado
constant fDiv_Max : natural := Fclock/(697*64)-1;
subtype IntDiv_t is integer range 0 to fDiv_Max;
type Ftable_t is array (0 to 3) of IntDiv_t;
constant F1table : Ftable_t
:= ( Fclock/(697*64)-1, Fclock/(770*64)-1,
Fclock/(852*64)-1, Fclock/(941*64)-1 );
signal Div1 : IntDiv_t;
signal or input Fsel : std_logic_vector (1 downto 0);
..../...
the decoder is then simply :
Div1 <= F1table(to_integer(unsigned(Fsel)));
which you may register or not, reset or not, load or not etc....
..../...
Using "integer range" for divisors gets rid of the log2 annoyance and corner cases
(it says you need two bits to divide by 2...) and you have either to use math_real
(not always supported at synthesis) or a custom function. 0 is also faster to write
than (others=>'0'), and it means less cumbersome conversions and type conversions.
You must verify that your design rules accept integer ranges (I know some disallow
them, but mines don't).
Obviously, this also means you should have the freq div in the same module as the
UART core to benefit from the integer range (they are ruled out in ports). But that
brings another debated issue of partitioning granularity....
Hope this helps,
Bert