문제

How do I assign the highest nibble (4 bits) in one register (8 bits), to the highest nibble of another register in one step? without altering the 4 LSbs?

Here is my proposed solution, when I can do it in two steps, but I believe there is more ingenious solution to do it in only one step (maybe with less gates or instructions):

  • REGA &= (REGB | 0x0F);
  • REGA |= (REGB & 0xF0);

Could anyone good with digital design help? (it's 3 AM and I can't sleep without a relief :-/)

도움이 되었습니까?

해결책

A = (A & 0x0F) | (B & 0xF0)

(Note that this operation requires zero gates, though...)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top