V
Valentin Tihomirov
Guest
The task is to update N first bits of a M-bit wide register. I can accompany
each input with a flag telling whether input should be updated or not.
Alternatively, I can calculate validity of an input with a <N comparator at
the input.
This issue is very similar to coding scheme of FSM states. The first of the
options corresponds to Gray style, the second is natural compact coding. Now
I need to choose between them. Cosidering Performance vs. Area trade off, I
think that solution with flags is faster because of much simpler
combinatorial logic. For the same reason it should consume less area.
Maximal value of N is 7.
Question: Which one would you choose?
Quantitative approach:
Logic required for flags:
- N flag registers.
Logic required for comparators:
log2(N)-bit wide register for for holding N;
N comparators;
complexity of comparator is proportional to log2(N), i.e. k*log2(N)
----------------
total: N regs vs. log2(N) regs + N*k*Log2(N) gates
This shows that Gray coding is good for large N as well. There should be a
mistake in calculations.
each input with a flag telling whether input should be updated or not.
Alternatively, I can calculate validity of an input with a <N comparator at
the input.
This issue is very similar to coding scheme of FSM states. The first of the
options corresponds to Gray style, the second is natural compact coding. Now
I need to choose between them. Cosidering Performance vs. Area trade off, I
think that solution with flags is faster because of much simpler
combinatorial logic. For the same reason it should consume less area.
Maximal value of N is 7.
Question: Which one would you choose?
Quantitative approach:
Logic required for flags:
- N flag registers.
Logic required for comparators:
log2(N)-bit wide register for for holding N;
N comparators;
complexity of comparator is proportional to log2(N), i.e. k*log2(N)
----------------
total: N regs vs. log2(N) regs + N*k*Log2(N) gates
This shows that Gray coding is good for large N as well. There should be a
mistake in calculations.