Okay, I think this should work.
If I understood correctly you are trying to create a Jinja template for a module that will multiply with 1/2 (in other words divide by two). First of all, make sure your Jinja file and module are named the same (this is a must so PyGears would know which Jinja template to use).
Having all this in mind let's say our module name is mulh
Python file would be something like this:
from pygears import gear, Intf, reg
from pygears.typing import Uint
from pygears.hdl import hdlgen
@gear
def mulh(din: Uint,*,half=False)->b'din*din':
pass
mulh(Intf(Uint[8]))
hdlgen('/mulh', outdir='.')
This code will call your Jinja file and the HDL output would look like something like this:
module mulh
(
input logic clk,
input logic rst,
dti.consumer din, // u8 (8)
dti.producer dout // u16 (16)
);
typedef logic [7:0] din_t; // u8
typedef logic [15:0] dout_t; // u16
din_t din_s;
dout_t dout_s;
assign din_s = din.data;
assign dout.data = dout_s;
logic [$size(din.data)-1 : 0] res;
assign res = din.data * din.data;
assign dout.data = res;
assign din.ready = dout.ready;
assign dout.valid = din.valid;
endmodule
To make it easier to picture all of this I made this picture bellow
