Logic of the RTL code:
The parameter lifo_depth is used to specify the depth of the stack desired. The parameter data_width is used to specify the width of the data. Asynchronous reset rst and positive edge triggered clock clk is used. DataIn is the input.
DataOut is output. An array lifo_array is used to store the values that are written into the LIFO. The LIFO is written into from the bottom to the top, if Write Enable wren is High. Hence, after each write operation the Write pointer wrptr has to be incremented by 1, if Write Pointer Increment enable WrInc is High. If Write Pointer Clear WrPtrClr is High, the Write Pointer is reset to point to the bottom of the LIFO. The count of the number of data bytes written into the LIFO is stored in wr_cnt. The LIFO is read from the top to the bottom if Read Enable rden is High. Hence, after each operation the Read pointer rdptr has to be decremented by 1, if Read pointer Decrement Enable RdDec is High. The Read pointer has to be reset to point to the top of the stack if Read Pointer Clear RdPtrClr is High. The count of the number of bytes read from the stack is stored in rd_cnt.