class Constraints:
- def __init__(self, in_clk, in_rst_n, spi2csr0, led0):
+ def __init__(self, in_rst_n, cd_in, spi2csr0, led0):
self.constraints = []
def add(signal, pin, vec=-1, iostandard="3.3-V LVTTL", extra="", sch=""):
self.constraints.append((signal, vec, pin, iostandard, extra,sch))
add(signal, p, i, iostandard, extra)
i += 1
# sys_clk
- add(in_clk, "R8") # CLOCK_50
+ add(cd_in.clk, "R8") # CLOCK_50
# sys_rst
add(in_rst_n, "J15") # KEY[0]
# Trigger
term0 = trigger.Term(trig_width)
+
trigger0 = trigger.Trigger(TRIGGER_ADDR, trig_width, dat_width, [term0])
# Recorder
]
sinus = [int(128*sin((2*3.1415)/256*(x+1)))+128 for x in range(256)]
- print(sinus)
sinus_re = Signal()
sinus_gen = Signal(BV(8))
comb +=[sinus_re.eq(1)]
recorder0.trig_hit.eq(trigger0.hit)
]
-
+
# HouseKeeping
- in_clk = Signal()
+ cd_in = ClockDomain("in")
in_rst_n = Signal()
- in_rst = Signal()
comb += [
- in_rst.eq(~in_rst_n)
+ cd_in.rst.eq(~in_rst_n)
]
+
frag = autofragment.from_local()
frag += Fragment(sync=sync,comb=comb,memories=[sinus_mem])
- cst = Constraints(in_clk, in_rst_n, spi2csr0, led0)
+ cst = Constraints(in_rst_n, cd_in, spi2csr0, led0)
src_verilog, vns = verilog.convert(frag,
cst.get_ios(),
name="de1",
- clk_signal = in_clk,
- rst_signal = in_rst,
+ clock_domains={
+ "sys": cd_in
+ },
return_ns=True)
src_qsf = cst.get_qsf(vns)
return (src_verilog, src_qsf)
\ No newline at end of file
class Constraints:
- def __init__(self, in_clk, in_rst_n, spi2csr0, led0, sw0):
+ def __init__(self, in_rst_n, cd_in, spi2csr0, led0, sw0):
self.constraints = []
def add(signal, pin, vec=-1, iostandard="3.3-V LVTTL", extra="", sch=""):
self.constraints.append((signal, vec, pin, iostandard, extra,sch))
add(signal, p, i, iostandard, extra)
i += 1
# sys_clk
- add(in_clk, "L1") # CLOCK_50
+ add(cd_in.clk, "L1") # CLOCK_50
# sys_rst
- add(in_rst_n, "R22") # KEY[0]
-
+ add(in_rst_n, "R22") # KEY[0]
+
# spi2csr0
add(spi2csr0.spi_clk, "F13") #GPIO_1[9]
add(spi2csr0.spi_cs_n, "G15") #GPIO_1[3]
]
sinus = [int(128*sin((2*3.1415)/256*(x+1)))+128 for x in range(256)]
- print(sinus)
sinus_re = Signal()
sinus_gen = Signal(BV(8))
comb +=[sinus_re.eq(1)]
# HouseKeeping
- in_clk = Signal()
+ cd_in = ClockDomain("in")
in_rst_n = Signal()
- in_rst = Signal()
comb += [
- in_rst.eq(~in_rst_n)
+ cd_in.rst.eq(~in_rst_n)
]
+
frag = autofragment.from_local()
frag += Fragment(sync=sync,comb=comb,memories=[sinus_mem])
- cst = Constraints(in_clk, in_rst_n, spi2csr0, led0, sw0)
+ cst = Constraints(in_rst_n, cd_in, spi2csr0, led0, sw0)
src_verilog, vns = verilog.convert(frag,
cst.get_ios(),
name="de1",
- clk_signal = in_clk,
- rst_signal = in_rst,
+ clock_domains={
+ "sys": cd_in
+ },
return_ns=True)
src_qsf = cst.get_qsf(vns)
return (src_verilog, src_qsf)
\ No newline at end of file