Add testing SystemVerilog and LiteX Module

This commit is contained in:
Aadi Desai 2023-02-26 19:40:56 +00:00
parent 9322fe0fd4
commit e1b0d5c28c
No known key found for this signature in database
2 changed files with 35 additions and 0 deletions

15
rtl/flip.sv Normal file
View file

@ -0,0 +1,15 @@
module flip
( input var clk
, output var ledr
, output var ledg
, output var ledb
);
logic [31:0] counter;
always_ff @(posedge clk)
counter <= counter + 1;
assign {ledr, ledg, ledb} = ~counter[27:25];
endmodule

20
testLED.py Normal file
View file

@ -0,0 +1,20 @@
from migen import *
from migen.genlib.misc import WaitTimer
from litex.soc.interconnect.csr import *
# Test LED Module ----------------------------------------------------------------------------------
class TestLed(Module, AutoCSR):
def __init__(self, platform, pads):
self.pads = pads
leds = Signal(3)
self.comb += pads.eq(leds)
self.specials += Instance("flip",
i_clk = ClockSignal(),
o_ledr = leds[0],
o_ledg = leds[1],
o_ledb = leds[2]
)
platform.add_source("rtl/flip.sv")