litex/tb/framebuffer/framebuffer.py

38 lines
753 B
Python
Raw Normal View History

2013-05-22 11:10:13 -04:00
from migen.fhdl.std import *
2012-07-03 13:04:44 -04:00
from migen.bus import asmibus
2012-07-07 05:30:43 -04:00
from migen.sim.generic import Simulator
2012-07-03 13:04:44 -04:00
from milkymist.framebuffer import *
def main():
hub = asmibus.Hub(16, 128)
port = hub.get_port()
hub.finalize()
dut = Framebuffer(1, port, True)
fragment = hub.get_fragment() + dut.get_fragment()
2013-02-09 11:09:29 -05:00
sim = Simulator(fragment)
2012-07-03 13:04:44 -04:00
sim.run(1)
def csr_w(addr, d):
sim.wr(dut.bank.description[addr].field.storage, d)
2012-07-06 18:11:58 -04:00
hres = 4
vres = 4
csr_w(1, hres) # hres
csr_w(2, hres+3) # hsync_start
csr_w(3, hres+5) # hsync_stop
csr_w(4, hres+10) # hscan
csr_w(5, vres) # vres
csr_w(6, vres+3) # vsync_start
csr_w(7, vres+5) # vsync_stop
csr_w(8, vres+10) # vscan
csr_w(10, hres*vres*4) # length
2012-07-03 13:04:44 -04:00
csr_w(0, 1) # enable
2012-07-06 18:11:58 -04:00
sim.run(1000)
2012-07-03 13:04:44 -04:00
main()