Advertisement
Guest User

Untitled

a guest
Aug 9th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. #!/bin/python3
  2.  
  3. from migen import *
  4. from migen.fhdl import verilog
  5.  
  6. class crc7(Module):
  7.     def __init__(self):
  8.         self.crc = crc = [Signal(7) for i in range(48)]
  9.         self.val =  val = Signal(40)
  10.  
  11.         for i in range(40):
  12.             inv = val[39-i] ^ crc[i][6]
  13.             self.comb += crc[i+1].eq(Cat(inv, crc[i][0], crc[i][1], crc[i][2]^inv, crc[i][3], crc[i][4], crc[i][5] ))
  14.  
  15.  
  16. def counter_test(dut):
  17.     yield dut.val.eq(0x3700000120)
  18.     #yield dut.val.eq(0x7700000000)
  19.     yield
  20.     print(format((yield dut.crc[40]),'02x'))
  21.  
  22.  
  23. dut = crc7()
  24. run_simulation(dut, counter_test(dut), vcd_name="basic2.vcd")
  25. #print(verilog.convert(crc7()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement