module M_main (
out_leds,
in_run,
out_done,
reset,
out_clock,
clock
);
output  [7:0] out_leds;
input in_run;
output out_done;
input reset;
output out_clock;
input clock;
assign out_clock = clock;
wire signed [15:0] _w_mul_ret;
wire _w_mul_done;
reg signed [15:0] _t_result;

reg signed [15:0] _d_m0;
reg signed [15:0] _q_m0;
reg signed [15:0] _d_m1;
reg signed [15:0] _q_m1;
reg  [7:0] _d_leds;
reg  [7:0] _q_leds;
reg signed [15:0] _d_mul_im0,_q_mul_im0;
reg signed [15:0] _d_mul_im1,_q_mul_im1;
reg  [3:0] _d_index,_q_index = 13;
reg  _autorun = 0;
assign out_leds = _q_leds;
assign out_done = (_q_index == 13) & _autorun;
M_mulpip16__mul mul (
.in_im0(_d_mul_im0),
.in_im1(_d_mul_im1),
.out_ret(_w_mul_ret),
.out_done(_w_mul_done),
.reset(reset),
.clock(clock));



`ifdef FORMAL
initial begin
assume(reset);
end
assume property($initstate || (out_done));
`endif
always @* begin
_d_m0 = _q_m0;
_d_m1 = _q_m1;
_d_leds = _q_leds;
_d_mul_im0 = _q_mul_im0;
_d_mul_im1 = _q_mul_im1;
_d_index = _q_index;
// _always_pre
_t_result = _w_mul_ret;
_d_mul_im0 = _q_m0;
_d_mul_im1 = _q_m1;
_d_leds = _t_result[0+:8];
(* full_case *)
case (_q_index)
0: begin
// _top
_d_m0 = 2;
_d_m1 = 3;
$display("%d * %d = ...",_d_m0,_d_m1);
_d_index = 1;
end
1: begin
// __block_1
_d_m0 = _q_m0+1;
_d_m1 = -_q_m1-1;
$display("%d * %d = ...",_d_m0,_d_m1);
_d_index = 2;
end
2: begin
// __block_2
_d_m0 = _q_m0+1;
_d_m1 = -_q_m1+1;
$display("%d * %d = ...",_d_m0,_d_m1);
_d_index = 3;
end
3: begin
// __block_3
_d_m0 = _q_m0+1;
_d_m1 = -_q_m1-1;
$display("%d * %d = ...",_d_m0,_d_m1);
_d_index = 4;
end
4: begin
// __block_4
_d_m0 = _q_m0+1;
_d_m1 = -_q_m1+1;
$display("%d * %d = ...",_d_m0,_d_m1);
_d_index = 5;
end
5: begin
// __block_5
_d_m0 = _q_m0+1;
_d_m1 = -_q_m1-1;
$display("%d * %d = ...",_d_m0,_d_m1);
_d_index = 6;
end
6: begin
// __block_6
$display("... = %d",_t_result);
_d_index = 7;
end
7: begin
// __block_7
$display("... = %d",_t_result);
_d_index = 8;
end
8: begin
// __block_8
$display("... = %d",_t_result);
_d_index = 9;
end
9: begin
// __block_9
$display("... = %d",_t_result);
_d_index = 10;
end
10: begin
// __block_10
$display("... = %d",_t_result);
_d_index = 11;
end
11: begin
// __block_11
$display("... = %d",_t_result);
_d_index = 12;
end
12: begin
// __block_12
_d_index = 13;
end
13: begin // end of 
end
default: begin 
_d_index = {4{1'bx}};
`ifdef FORMAL
assume(0);
`endif
 end
endcase
// _always_post
end

always @(posedge clock) begin
_q_m0 <= (reset) ? 0 : _d_m0;
_q_m1 <= (reset) ? 0 : _d_m1;
_q_leds <= (reset) ? 0 : _d_leds;
_q_index <= reset ? 13 : ( ~_autorun ? 0 : _d_index);
_autorun <= reset ? 0 : 1;
_q_mul_im0 <= _d_mul_im0;
_q_mul_im1 <= _d_mul_im1;
end

endmodule