examples/de1 : add ramp / square mode
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Sat, 15 Sep 2012 20:29:50 +0000 (22:29 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Sat, 15 Sep 2012 20:29:50 +0000 (22:29 +0200)
examples/de1/client/test_MigLa.py
examples/de1/top.py

index d89c41e2d7091749e665b651f41671ebb38c212d..e5dbb893e239fda275f2823a9c2144ce100073cb 100644 (file)
@@ -22,7 +22,7 @@ trig_width = 16
 dat_width = 16
 
 # Record Size
-record_size = 1024
+record_size = 4096
 
 # Csr Addr
 MIGIO0_ADDR   = 0x0000
@@ -45,13 +45,15 @@ recorder0 = recorder.Recorder(RECORDER_ADDR, dat_width, record_size, csr)
 #==============================================================================
 #                  T E S T  M I G L A 
 #==============================================================================
-term0.write(0x005A)
+term0.write(0x0000)
 
 sum_tt = gen_truth_table("term0")
 trigger0.sum.write(sum_tt)
 
+csr.write(0x0000,0)
+
 recorder0.reset()
-recorder0.size(256)
+recorder0.size(1024)
 recorder0.offset(0)
 recorder0.arm()
 print("-Recorder [Armed]")
@@ -62,7 +64,7 @@ print("[Done]")
 
 print("-Receiving Data...", end = ' ')
 sys.stdout.flush()
-dat_vcd = recorder0.read(256)
+dat_vcd = recorder0.read(1024)
 print("[Done]")
 
 myvcd = Vcd()
index 39c106a20b8d9f0667550da2308b315b36b34d30..41480cf00546f3f4a262dd0cc037d5f7f38cf8a3 100644 (file)
@@ -62,7 +62,7 @@ trig_width = 16
 dat_width = 16
 
 # Record Size
-record_size = 1024
+record_size = 4096
 
 # Csr Addr
 MIGIO_ADDR  = 0x0000
@@ -98,11 +98,55 @@ def get():
        comb = []
        sync = []
        
+       #
        # Signal Generator
-       sig_gen = Signal(BV(trig_width))
+       #
+       
+       # Counter
+       cnt_gen = Signal(BV(8))
+       sync += [
+               cnt_gen.eq(cnt_gen+1)
+       ]
+       
+       # Square
+       square_gen = Signal(BV(8))
+       sync += [
+               If(cnt_gen[7],
+                       square_gen.eq(255)
+               ).Else(
+                       square_gen.eq(0)
+               )
+       ]
+       
+       
+       # Signal Selection
+       sig_gen = Signal(BV(8))
+       comb += [
+               If(migIo0.o == 0,
+                       sig_gen.eq(cnt_gen)
+               ).Elif(migIo0.o == 1,
+                       sig_gen.eq(square_gen)
+               ).Else(
+                       sig_gen.eq(0)
+               )
+       ]
+       
+       ramp_gen = Signal(BV(8))
        sync += [
-               sig_gen.eq(sig_gen+1)
+               ramp_gen.eq(ramp_gen+1)
        ]
+       
+       square_gen = Signal(BV(8))
+       sync += [
+               
+               ramp_gen.eq(ramp_gen+1)
+       ]
+       
+       
+       
+       
+       
+       
        #comb += [sig_gen.eq(migIo0.o)]
        
        # Led