Hi hayaoki7,
The S32K microprocessor has a dedicated peripheral that can be used to implement any kind of protocol. The peripheral is called FlexIO.
The FlexIO is a highly configurable module providing a wide range of functionality including:
- Emulation of a variety of serial communication protocols
- Flexible 16-bit timers with support for a variety of trigger, reset, enable and disable conditions
For documentation you can check the https://www.nxp.com/docs/en/reference-manual/S32K-RM.pdf chapter 51
The NXP Model Based Design Toolbox for S32K1xx implements I2C/SPI and UART protocols over FlexIO by calling dedicated drivers from SDK.

In your case, since your encoder support a slightly different communication protocol you will have to configure the FlexIO peripheral in a slightly different manner.
For that you will need too implement standard Simulink S-Function Builder block or to use the Simulink Coder to call your custom code. You can check this as a starting point: https://community.nxp.com/thread/449904#comment-901737 on how to call your own C-code from Simulink models.
In general for custom code you should consult the MATLAB documentation since it is a standard feature.
Hope this helps!
Daniel