summaryrefslogtreecommitdiff
path: root/hdl/template.py
blob: 5df554c8ae194dcc970b802019f7e7a768800c08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from amaranth import *
from amaranth.sim import Simulator, Settle, Delay

from utils import cmd

class Template(Elaboratable):
    def __init__(self):
        ...

        self.ports = [...]

    def elaborate(self, platform):
        m = Module()

        ...

        return m

def test(filename="out.vcd"):
    dut = ...

    def proc1():
        ...


    sim = Simulator(dut)
    sim.add_clock(1e-6)
    sim.add_sync_process(proc1)
    
    with sim.write_vcd(filename):
        sim.run()


if __name__ == '__main__':
    shift_reg = Template(8)
    cmd(shift_reg, test)