//
// Generated by Bluespec Compiler, version 2019.05.beta2 (build a88bf40db, 2019-05-24)
//
//
//
//
// Ports:
// Name                         I/O  size props
// amoExec                        O    64
// amoExec_amo_inst               I     7
// amoExec_current_data           I    64
// amoExec_in_data                I    64
// amoExec_upper_32_bits          I     1
//
// Combinational paths from inputs to outputs:
//   (amoExec_amo_inst,
//    amoExec_current_data,
//    amoExec_in_data,
//    amoExec_upper_32_bits) -> amoExec
//
//

`ifdef BSV_ASSIGNMENT_DELAY
`else
  `define BSV_ASSIGNMENT_DELAY
`endif

`ifdef BSV_POSITIVE_RESET
  `define BSV_RESET_VALUE 1'b1
  `define BSV_RESET_EDGE posedge
`else
  `define BSV_RESET_VALUE 1'b0
  `define BSV_RESET_EDGE negedge
`endif

module module_amoExec(amoExec_amo_inst,
		      amoExec_current_data,
		      amoExec_in_data,
		      amoExec_upper_32_bits,
		      amoExec);
  // value method amoExec
  input  [6 : 0] amoExec_amo_inst;
  input  [63 : 0] amoExec_current_data;
  input  [63 : 0] amoExec_in_data;
  input  amoExec_upper_32_bits;
  output [63 : 0] amoExec;

  // signals for module outputs
  wire [63 : 0] amoExec;

  // remaining internal signals
  reg [63 : 0] _theResult_____1__h29,
	       _theResult___fst__h122,
	       _theResult___fst__h183,
	       _theResult___snd__h123;
  wire [63 : 0] SEXT_amoExec_current_data_BITS_31_TO_0_7___d18,
		SEXT_amoExec_current_data_BITS_63_TO_32_3___d14,
		SEXT_amoExec_in_data_BITS_31_TO_0____d8,
		_theResult___fst__h113,
		current_data__h27,
		in_data__h28,
		new_data__h249,
		new_data__h373,
		new_data__h379,
		new_data__h385,
		new_data__h391,
		new_data__h405,
		new_data__h419,
		new_data__h433;
  wire [31 : 0] amoExec_current_data_BITS_31_TO_0__q3,
		amoExec_current_data_BITS_63_TO_32__q1,
		amoExec_in_data_BITS_31_TO_0__q2;
  wire IF_amoExec_amo_inst_BIT_2_THEN_amoExec_current_ETC___d30,
       IF_amoExec_amo_inst_BIT_2_THEN_amoExec_current_ETC___d34;

  // value method amoExec
  assign amoExec =
	     amoExec_amo_inst[2] ?
	       _theResult_____1__h29 :
	       (amoExec_upper_32_bits ?
		  { _theResult_____1__h29[31:0],
		    amoExec_current_data[31:0] } :
		  { amoExec_current_data[63:32],
		    _theResult_____1__h29[31:0] }) ;

  // remaining internal signals
  assign IF_amoExec_amo_inst_BIT_2_THEN_amoExec_current_ETC___d30 =
	     (current_data__h27 ^ 64'h8000000000000000) <=
	     (in_data__h28 ^ 64'h8000000000000000) ;
  assign IF_amoExec_amo_inst_BIT_2_THEN_amoExec_current_ETC___d34 =
	     current_data__h27 <= in_data__h28 ;
  assign SEXT_amoExec_current_data_BITS_31_TO_0_7___d18 =
	     { {32{amoExec_current_data_BITS_31_TO_0__q3[31]}},
	       amoExec_current_data_BITS_31_TO_0__q3 } ;
  assign SEXT_amoExec_current_data_BITS_63_TO_32_3___d14 =
	     { {32{amoExec_current_data_BITS_63_TO_32__q1[31]}},
	       amoExec_current_data_BITS_63_TO_32__q1 } ;
  assign SEXT_amoExec_in_data_BITS_31_TO_0____d8 =
	     { {32{amoExec_in_data_BITS_31_TO_0__q2[31]}},
	       amoExec_in_data_BITS_31_TO_0__q2 } ;
  assign _theResult___fst__h113 =
	     amoExec_upper_32_bits ?
	       _theResult___fst__h183 :
	       _theResult___fst__h122 ;
  assign amoExec_current_data_BITS_31_TO_0__q3 = amoExec_current_data[31:0] ;
  assign amoExec_current_data_BITS_63_TO_32__q1 =
	     amoExec_current_data[63:32] ;
  assign amoExec_in_data_BITS_31_TO_0__q2 = amoExec_in_data[31:0] ;
  assign current_data__h27 =
	     amoExec_amo_inst[2] ?
	       amoExec_current_data :
	       _theResult___fst__h113 ;
  assign in_data__h28 =
	     amoExec_amo_inst[2] ? amoExec_in_data : _theResult___snd__h123 ;
  assign new_data__h249 = current_data__h27 + in_data__h28 ;
  assign new_data__h373 = current_data__h27 ^ in_data__h28 ;
  assign new_data__h379 = current_data__h27 & in_data__h28 ;
  assign new_data__h385 = current_data__h27 | in_data__h28 ;
  assign new_data__h391 =
	     IF_amoExec_amo_inst_BIT_2_THEN_amoExec_current_ETC___d30 ?
	       current_data__h27 :
	       in_data__h28 ;
  assign new_data__h405 =
	     IF_amoExec_amo_inst_BIT_2_THEN_amoExec_current_ETC___d30 ?
	       in_data__h28 :
	       current_data__h27 ;
  assign new_data__h419 =
	     IF_amoExec_amo_inst_BIT_2_THEN_amoExec_current_ETC___d34 ?
	       current_data__h27 :
	       in_data__h28 ;
  assign new_data__h433 =
	     IF_amoExec_amo_inst_BIT_2_THEN_amoExec_current_ETC___d34 ?
	       in_data__h28 :
	       current_data__h27 ;
  always@(amoExec_amo_inst or
	  amoExec_current_data or
	  SEXT_amoExec_current_data_BITS_63_TO_32_3___d14)
  begin
    case (amoExec_amo_inst[6:3])
      4'd5, 4'd6:
	  _theResult___fst__h183 =
	      SEXT_amoExec_current_data_BITS_63_TO_32_3___d14;
      default: _theResult___fst__h183 =
		   { 32'd0, amoExec_current_data[63:32] };
    endcase
  end
  always@(amoExec_amo_inst or
	  amoExec_in_data or SEXT_amoExec_in_data_BITS_31_TO_0____d8)
  begin
    case (amoExec_amo_inst[6:3])
      4'd5, 4'd6:
	  _theResult___snd__h123 = SEXT_amoExec_in_data_BITS_31_TO_0____d8;
      default: _theResult___snd__h123 = { 32'd0, amoExec_in_data[31:0] };
    endcase
  end
  always@(amoExec_amo_inst or
	  amoExec_current_data or
	  SEXT_amoExec_current_data_BITS_31_TO_0_7___d18)
  begin
    case (amoExec_amo_inst[6:3])
      4'd5, 4'd6:
	  _theResult___fst__h122 =
	      SEXT_amoExec_current_data_BITS_31_TO_0_7___d18;
      default: _theResult___fst__h122 = { 32'd0, amoExec_current_data[31:0] };
    endcase
  end
  always@(amoExec_amo_inst or
	  in_data__h28 or
	  new_data__h249 or
	  new_data__h373 or
	  new_data__h379 or
	  new_data__h385 or
	  new_data__h391 or
	  new_data__h405 or new_data__h419 or new_data__h433)
  begin
    case (amoExec_amo_inst[6:3])
      4'd0: _theResult_____1__h29 = in_data__h28;
      4'd1: _theResult_____1__h29 = new_data__h249;
      4'd2: _theResult_____1__h29 = new_data__h373;
      4'd3: _theResult_____1__h29 = new_data__h379;
      4'd4: _theResult_____1__h29 = new_data__h385;
      4'd5: _theResult_____1__h29 = new_data__h391;
      4'd6: _theResult_____1__h29 = new_data__h405;
      4'd7: _theResult_____1__h29 = new_data__h419;
      4'd8: _theResult_____1__h29 = new_data__h433;
      default: _theResult_____1__h29 = 64'd0;
    endcase
  end
endmodule  // module_amoExec

