Guest User

Untitled

a guest
Jul 23rd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.59 KB | None | 0 0
  1. from litex.gen import *
  2.  
  3. from litex.soc.interconnect.stream import *
  4. from litex.soc.interconnect.stream_sim import *
  5.  
  6. from litejpeg.core.common import *
  7. from litejpeg.core.huffman.huffman import Huffman
  8.  
  9. from common import *
  10.  
  11. # Testbanch for the Huffman module.
  12.  
  13. """
  14. Under this module a matrix containing 64 blocks is been sent as an
  15. input to the Huffman and the output is been printed and compared
  16. with the one from the reference modules.
  17. In this way the result from the Huffman is been verified.
  18. """
  19. class TB(Module):
  20.     def __init__(self):
  21.         # Making pipeline and the getting the Huffman module.
  22.         """
  23.        Streamer : It will pass the input to the Huffman.
  24.                   The data is a 20 bit number in the matrix.
  25.                   Streamer[0:12] = Amplitude
  26.                   Streamer[12:16] = Size of the Amplitude
  27.                   Streamer[16:20] = Runlength
  28.  
  29.        Logger : It will get the output to the TestBench.
  30.                 The output of the testBench is the variable length values of the
  31.                 ranging from 0,8 or 16 bits depending upon the encoding done
  32.                 as per the huffman tables.
  33.        """
  34.         self.submodules.streamer = PacketStreamer(EndpointDescription([("data", 20)]))
  35.         self.submodules.huffman = Huffman()
  36.         self.submodules.logger = PacketLogger(EndpointDescription([("data", 16)]))
  37.  
  38.         # Connecting TestBench with the RLEcore module.
  39.         self.comb += [
  40.             self.streamer.source.connect(self.huffman.sink),
  41.             self.huffman.source.connect(self.logger.sink)
  42.         ]
Add Comment
Please, Sign In to add comment