litex/top.py

94 lines
1.6 KiB
Python
Raw Normal View History

2012-08-12 08:21:30 -04:00
from fractions import Fraction
from math import ceil
from migen.fhdl.structure import *
from migen.fhdl import verilog, autofragment
from migen.bus import csr
2012-08-26 15:30:23 -04:00
from migScope import trigger
from migScope import recorder
2012-08-12 19:02:38 -04:00
import spi2Csr
2012-08-12 08:21:30 -04:00
2012-08-26 09:15:44 -04:00
from migScope.tools.truthtable import *
2012-08-12 08:21:30 -04:00
#
2012-08-12 13:39:26 -04:00
#Test Term
2012-08-12 08:21:30 -04:00
#
2012-08-26 15:30:23 -04:00
#term = trigger.Term(32,True)
2012-08-12 08:21:30 -04:00
#v = verilog.convert(term.get_fragment())
#print(v)
#
#Test RangeDetector
#
2012-08-26 15:30:23 -04:00
#rangeDetector = trigger.RangeDetector (32,True)
2012-08-12 08:21:30 -04:00
#v = verilog.convert(rangeDetector.get_fragment())
#print(v)
#
#Test EdgeDetector
#
2012-08-26 15:30:23 -04:00
#edgeDetector = trigger.EdgeDetector (32,True,"RFB")
2012-08-12 08:21:30 -04:00
#v = verilog.convert(edgeDetector.get_fragment())
#print(v)
#
#Test Timer
#
2012-08-26 15:30:23 -04:00
#timer = trigger.Timer(32)
2012-08-12 08:21:30 -04:00
#v = verilog.convert(timer.get_fragment())
#print(v)
#
#Test Sum
#
2012-08-26 15:30:23 -04:00
#sum = trigger.Sum(4,pipe=False)
2012-08-12 10:04:52 -04:00
#v = verilog.convert(sum.get_fragment())
#print(v)
2012-08-12 08:21:30 -04:00
#
#Test Storage
2012-08-12 08:21:30 -04:00
#
2012-08-26 15:30:23 -04:00
#storage = recorder.Storage(32,1024)
#v = verilog.convert(storage.get_fragment())
2012-08-12 10:04:52 -04:00
#print(v)
#
#Test Sequencer
#
2012-08-26 15:30:23 -04:00
#sequencer = recorder.Sequencer(1024)
#v = verilog.convert(sequencer.get_fragment())
#print(v)
#
#Test Recorder
#
2012-08-26 15:30:23 -04:00
#recorder = recorder.Recorder(0,32,1024)
2012-08-12 13:30:27 -04:00
#v = verilog.convert(recorder.get_fragment())
#print(v)
2012-08-12 13:39:26 -04:00
#
#Test Trigger
#
2012-08-26 15:30:23 -04:00
term0 = trigger.Term(32)
term1 = trigger.RangeDetector(32)
term2 = trigger.EdgeDetector(32)
term3 = trigger.Term(32)
2012-08-12 13:30:27 -04:00
2012-08-26 15:30:23 -04:00
trigger0 = trigger.Trigger(0,32,64,[term0, term1, term2, term3])
recorder0 = recorder.Recorder(0,32,1024)
2012-08-25 12:46:58 -04:00
v = verilog.convert(trigger0.get_fragment()+recorder0.get_fragment())
print(v)
2012-08-12 19:02:38 -04:00
#
#Test spi2Csr
#
2012-08-25 12:46:58 -04:00
#spi2csr0 = spi2Csr.Spi2Csr(16,8)
#v = verilog.convert(spi2csr0.get_fragment())
#print(v)
2012-08-12 13:39:26 -04:00
2012-08-26 09:15:44 -04:00
print(gen_truth_table("A&B&C"))
2012-08-12 19:02:38 -04:00