Changeset 532


Ignore:
Timestamp:
Jul 24, 2010, 9:24:50 AM (9 years ago)
Author:
cameron
Message:

Little endian demo functions/LaTeX formatted demos.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/bitutil.py

    r371 r532  
    124124        return str
    125125
     126def bitstream2stringLE(stream, lgth):
     127        str = ""
     128        for i in range(lgth):
     129                if stream & 1 == 1: str = '1' + str
     130                else: str = '_' + str
     131                stream >>= 1
     132        return str
     133
    126134def print_aligned_streams(stream_list):
    127135        """Print out a set of aligned streams."""
     
    129137        for p in stream_list:
    130138                print (p[0] + " "*(label_max - len(p[0]))) + ": " + p[1]
     139
     140def latex_streams(stream_list):
     141        """Return a latex table for streams."""
     142        table = "\\begin{tabular}{cr}"
     143        for p in stream_list:
     144                table += "\\\\\n" + p[0] +" & \\verb`" + p[1] +"`"
     145        return table + "\n\\end{tabular}\n"
    131146
    132147def print_aligned_u8_byte_streams(u8_byte_stream):
Note: See TracChangeset for help on using the changeset viewer.