Electronic – Exchange instruction of 8085 microprocessor

microprocessor

How XCHG instruction is executed by 8085 microprocessor ? By default XCHG instruction takes place between DE pair and HL pair. Suppose let us assume contents of DE pair is replaced by the contents of HL pair, then how contents of HL pair are replaced by the contents of DE pair, because it is already replaced by contents of HL pair. How this is possible ?

Best Answer

In Verilog HDL:

always @(posedge clk)
begin
  ...
  if (is_xchg_opcode)
  begin
     DE <= HL;
     HL <= DE;
  end