GfG QA is closing soon... Please refer PRACTICE or GfG now on wards !!

to perform compression and decompression of pin/port names in C language..as explained below.

I need a code that compresses and decompresses similar port names. The port names can contain characters : A-Z, a-z, 0-9,_, {}, [].

 

we will be using <> , - and , for compression.

 

For Eg:

1.) If we have port names such as:

BC_CNTL_BISTCNTL_BISTCNTL_ref1[4]
BC_CNTL_BISTCNTL_BISTCNTL_ref1[3]
BC_CNTL_BISTCNTL_BISTCNTL_ref1[2]
BC_CNTL_BISTCNTL_BISTCNTL_ref1[1]
BC_CNTL_BISTCNTL_BISTCNTL_ref1[0]

 

so they should be compressed as:

 

BC_CNTL_BISTCNTL_BISTCNTL_ref1[<0-4>]

 

2.) if we have:

A_port
N_port

it should be compressed to: <A,N>_port

3.) if we have:

A_port[0]
B_port[0]
A_port[1]
B_port[1]

it should be compressed to: <A-B>_port[0-1]

asked Jun 22, 2016 by neet
...