add test_MigLa.py (Wip)

fixes
This commit is contained in:
Florent Kermarrec 2012-09-14 14:08:20 +02:00
parent 79af96c190
commit 5b0a8a798f
4 changed files with 81 additions and 10 deletions

View File

@ -0,0 +1,69 @@
from migen.fhdl.structure import *
from migen.fhdl import verilog, autofragment
from migen.bus import csr
from migen.bus.transactions import *
from migen.bank import description, csrgen
from migen.bank.description import *
import sys
sys.path.append("../../../")
from migScope import trigger, recorder, migIo
from migScope.tools.truthtable import *
import spi2Csr
from spi2Csr.tools.uart2Spi import *
#==============================================================================
# P A R A M E T E R S
#==============================================================================
# Bus Width
trig_width = 16
dat_width = 16
# Record Size
record_size = 1024
# Csr Addr
MIGIO0_ADDR = 0x0000
TRIGGER_ADDR = 0x0200
RECORDER_ADDR = 0x0400
csr = Uart2Spi(1,115200)
# MigScope Configuration
# migIo
migIo0 = migIo.MigIo(MIGIO0_ADDR, 8, "IO",csr)
# Trigger
term0 = trigger.Term(trig_width)
term1 = trigger.Term(trig_width)
term2 = trigger.Term(trig_width)
term3 = trigger.Term(trig_width)
trigger0 = trigger.Trigger(TRIGGER_ADDR, trig_width, dat_width, [term0, term1, term2, term3], csr)
# Recorder
recorder0 = recorder.Recorder(RECORDER_ADDR, dat_width, record_size, csr)
#==============================================================================
# T E S T M I G L A
#==============================================================================
term0.write(0x5A)
term1.write(0x5A)
term2.write(0x5A)
term3.write(0x5A)
sum_tt = gen_truth_table("term0 & term1 & term2 & term3")
print(sum_tt)
trigger0.sum.write(sum_tt)
migIo0.write(0x5A)
recorder0.reset()
recorder0.size(256)
recorder0.offset(0)
recorder0.arm()
while(not recorder0.is_done()):
print(".")
time.sleep(1)

View File

@ -89,7 +89,7 @@ def get():
recorder0 = recorder.Recorder(RECORDER_ADDR, dat_width, record_size)
# Spi2Csr
spi2csr0 = spi2Csr.Spi2Csr(14,8)
spi2csr0 = spi2Csr.Spi2Csr(16,8)
# Csr Interconnect
csrcon0 = csr.Interconnect(spi2csr0.csr,
@ -109,7 +109,7 @@ def get():
# Led
led0 = Signal(BV(8))
comb += [led0.eq(migIo0.o[:8])]
#comb += [led0.eq(migIo0.o[:8])]
#Switch
sw0 = Signal(BV(8))
@ -124,13 +124,13 @@ def get():
trigger0.in_trig.eq(sig_gen),
trigger0.in_dat.eq(sig_gen)
]
#comb += [led0[7].eq(trigger0.sum.i)]
#comb += [led0[6].eq(trigger0.sum.o)]
comb += [led0[7].eq(trigger0.sum.i)]
comb += [led0[6].eq(trigger0.sum.o)]
#comb += [led0[3].eq(term3.o)]
#comb += [led0[2].eq(term2.o)]
#comb += [led0[1].eq(term1.o)]
#comb += [led0[0].eq(term0.o)]
comb += [led0[3].eq(term3.o)]
comb += [led0[2].eq(term2.o)]
comb += [led0[1].eq(term1.o)]
comb += [led0[0].eq(term0.o)]
# Trigger --> Recorder
comb += [

View File

@ -25,8 +25,7 @@ class MigIo:
self.interface.write_n(self.address, data, self.width)
def read(self):
r = 0
r = self.interface.read_n(self.address + self.words, self.width)
r = self.interface.read_n(self.address + self.words, self.width)
return r
def get_fragment(self):

View File

@ -44,5 +44,8 @@ void loop()
data = SF.rd(addrMsb<<8|addrLsb);
Serial.print(data);
}
else {
Serial.flush();
}
}
}