Describe oprtations


Write each operation.
The calculation result has 9-bit bus so that we can easily generate the carry flag.
After that, carry flag and operation result are reassigned to each variable.




Notes;


  ...
  reg    [8:0] tmp;		// operation result

  always @( ... or ... or ... )
  begin
    case ( CB )
    `IADD   : tmp <= { 1'b0, A } + { 1'b0, B }; // addition
       ...
       ...
       ...
    `ISWP   : tmp <= { 1'b0, A[3:0], A[7:4] }; // nibble swap
    default : tmp <= 9'bxxxxxxxxx;	       // don't care (for simulation)
    endcase
  end
  ...
  ...
  assign Y    = ... ;		// reassignment of result
  ...


Next, describe flags .


| Back | CAD Home |