typedef UInt#(51) NumTyp; interface ArithIO_IFC #(parameter type aTyp); // aTyp is a paramerized type method Action start(aTyp num1, aTyp num2); method aTyp result(); endinterface: ArithIO_IFC // The following is an attribute that tells the compiler to generate // separate code for mkGCD (* synthesize *) module mkGCD(ArithIO_IFC#(NumTyp)); // here aTyp is defined to be type Int Reg#(NumTyp) x(); // x is the interface to the register mkRegU reg_1(x); // reg_1 is the register instance Reg #(NumTyp) y(); // y is the interface to the register mkRegU reg_2(y); // reg_2 is the register instance rule flip (x > y && y != 0); x <= y; y <= x; endrule rule sub (x <= y && y != 0); y <= y - x; endrule method Action start(NumTyp num1, NumTyp num2) if (y == 0); action x <= num1; y <= num2; endaction endmethod: start method NumTyp result() if (y == 0); result = x; endmethod: result endmodule: mkGCD