"RCIngham" <
robert.ingham@n_o_s_p_a_m.n_o_s_p_a_m.gmail.com> wrote in
message news:kt-dnRe2Lb2cTi7S...@giganews.com...
> >What's the big deal about a latch?
>>
>
> It's usually harder to meet Static Timing Analysis with latches.
> They are as troublesome as a very troublesome thing.
> If you think you need to use one, think again.
In this particular case, it's grabbing a rather large 100 ns tick count, to
inject into a message as a timestamp later. Timing isn't an issue. The only
concern was relative space efficiency. There seems no difference between a
latch and FDE, eating up a slice every 2 bits.
I "solved" the other problem of serializing the multi-word timestamps by
sending 8-bit counts after the first full timestamp. The question remains,
though, how to efficiently byte-serialize the large data word. I hate to
hand write a state machine to do this, for every word size I might
encounter. Shifting the latched value seems unnecessarily painful.
Rotating a single hot bit in a surrogate shadow word, one bit representing a
data byte, seems so far the best solution, but I can't dream up a way to
generate the required statements to go with it. Rotating the surrogate mask
effectively makes for a cheap, easy one-hot FSM, but I don't have the
language skill to generate the corresponding:
with vmask select
dout <= w(47 downto 40) when b"100000",
dout <= w(39 downto 32) when b"010000",
dout <= w(32 downto 24) when b"001000",
...
Writing one for each N-sized word is tedious and error prone. Any help or
ideas?