//----------------------------------------------------------------------
// IAS0150 - Homework #2. Example task - #1, gates, no optimization.
//----------------------------------------------------------------------
// (C) Peeter Ellervee - 2026 - Tallinn
//----------------------------------------------------------------------
module fs_opti (input x1, x2, x3, x4, output y1, y2, y3, y4);
  logic x1i, x2i, x3i, x4i, t1, t2, t3, t4, t5, t6, t7, t8, t9, t19, t68;

  assign x1i = !x1;
  assign x2i = !x2;
  assign x3i = !x3;
  assign x4i = !x4;

  assign t1 = t4  & x1i & x3i;
  assign t2 = x1  & x3  & x4;
  assign t3 = x2  & x3i & x4i;
  assign t4 = x2  & x4;
  assign t5 = x2i & x3;
  assign t6 = t7  & x3;
  assign t7 = x1i & x4i;
  assign t8 = x1  & x2i & x4i;
  assign t9 = x1  & x3;

  assign t19 = t1 | t9;
  assign t68 = t6 | t8;

  assign y1 = t19 | t3 | t7;
  assign y2 = !(t19 | t8);
  assign y3 = t3 | t4 | t68;
  assign y4 = t2 | t5 | t68;

endmodule
