# PLORC: A Pipelined Lossless Reference-Free Compression Architecture for FASTQ Files
## 2 Proposed Compressor
### The ID Encoder Module
The difference between the situations shown in Figure 6a,b is are the same as that in Figure 6b, and the _'c_input'_ can not remain unchanged when waiting for the special character from _'base_ID'_ because it introduces stream interruption. Therefore, the _'base_ptr'_ should jump to the position of the next special character in _'base_ID'_. The position is provided by the FASTQ Splitter module. The other operations are the same as in Figure 5d. * In Figure 6c, the _'c_input'_ reaches the end of _'input_ID'_ first. The encoder should generate the output immediately and set the _'base_ptr'_ to zero to wait for new inputs. Figure 6: The special pattern segments in the ID encoding process. (**a**) The 'base_ID’ reaches a special character first. (**b**) The 'input_ID’ reaches a special character first. (**c**) The 'input_ID’ ends first. (**d**) The 'base_ID’ ends first. If the comparison status before the end is a pair of identical characters, the output should be generated from '_same_cnt_'. Otherwise, the output should be generated from '_diff_sym_' and '_diff_cnt_. * In Figure 6d, the '_c_base_' reaches the end of '_base_ID_' first. Under this situation, the following characters from '_input_ID_' should be treated as pairs of different characters because there is no character from '_base_ID_' to participate in the comparison. The encoder is supposed to wait until the '_input_ID_' reaches its end and then generate outputs from '_diff_sym_' and '_diff_cnt_'. An example is shown below to illustrate the encoding process on a real ID. Figure 7 shows an example of a real ID encoding result. Its encoding process is shown in Figure 8. The white blocks in Figures 7 and 8 represent 1-byte data. Our encoding method turns 44 bytes '_input_ID_' into a 9.5-byte encoding result, including a 4-bit '_len_diff_'. In Figure 8, '_c_base_' means a character from '_base_id_', and '_c_input_' means a character from '_input_id_'. The value of '_c_base_' changes with '_base_ptr_' and the '_c_input_' changes with the input stream. Figure 8: An example of a real ID encoding process. Figure 7: An example of a real ID encoding result. * The encoder first generates the _'len_diff'_ from the difference between the length of the current input ID and the previous ID in bytes. The _'c_input'_ character in each step is stored, and the number of _'c_input'_ characters is recorded by registers to update the _'base_id'_ at the end of the current comparison. * From Step (1) to Step (11) in Figure 8, the encoder encounters continuous identical characters, as shown in Figure 5a. The _'same_cnt'_ and _'base_ptr'_ registers the increase by one in each step. * The encoder encounters a pair of identical characters in Step (11) and then different characters in Step (12), as shown in Figure 5c. Therefore, the _'ID output'_ signal is generated from _'same_cnt'_. Meanwhile, _'diff_sym'_ and _'diff_cnt'_ begin to update. * In Step (12) and Step (13), the encoder encounters continuous different characters, as shown in Figure 5b. Then, _'diff_sym'_ and _'diff_cnt'_ registers continue to update. * The value of register _'c_base'_ becomes a special character in Step (13) first, as shown in Figure 6a. The _'c_base'_ register remains unchanged until the special character from _'input_id'_ arrives in Step (14). The _'ID output'_ signal is generated from _'diff_sym'_ and _'diff_cnt'_. * From Step (14) to Step (40), the encoder encounters continuous identical characters again. Then, _'same_cnt'_ and _'base_ptr'_ register the increase by one in each step. * The encoder encounters a pair of identical characters in Step (40) and a pair of different characters in Step (41). The pattern is the same as Step (11)-(12). * In Step (41) and Step (42), the encoder encounters continuous different characters. The pattern is the same as Steps (12)-(13). * The encoder encounters a pair of different characters in Step (42) and identical characters in Step (43), as shown in Figure 5d. The _'ID output'_ signal is generated from _'diff_sym'_ and _'diff_cnt'_. Meanwhile,'same_cnt'_ begins to update.