Prev Problem
Next Problem

62. Nibble Swap

Swap the high and low nibbles of an 8-bit input.

Requirements

  • Module: nibble_swap_task
  • Inputs: x[7:0]
  • Outputs: y[7:0]
  • Write a task swap_nibbles(input [7:0] xin, output [3:0] hi, output [3:0] lo) that extracts the high and low nibbles from xin.
  • Keep it fully combinational.

Behaviour

  • Input x[7:0]
  • Output y[7:0] = {x[3:0], x[7:4]}
Need Help? Refer to the Quick Guide below