digraph rom_sd {
    Reset [shape = doublecircle, label = "RESET\nbuffer_half = 0\nrom_addr = 0\nrom_enable = 1\nbuffer.addra=0\nready=0"];
    node [shape = circle];
    Delay1 [label="DELAY1\nrom_addr++"];
    Delay2 [label="DELAY2\nrom_addr++"];
    Delay3 [label="DELAY3\nrom_addr++\nbuffer.dina=rom_data\nbuffer.ena=1"];
    WriteBuf [label="WRITEBUF\nbuffer.ena=1\nbuffer.dina=rom_data\nbuffer.addra++\nrom_addr++"];
    EndWrite1 [label="ENDWRITE1\nbuffer.ena=1\nbuffer.data=rom_data\nbuffer.addra++"];
    EndWrite2 [label="ENDWRITE2\nbuffer.ena=1\nbuffer.data=rom_data\nbuffer.addra++"];
    EndWrite3 [label="ENDWRITE3\nbuffer.ena=0\nbuffer.data=rom_data\nbuffer.addra++\nready=1"];
    Wait [label = "WAIT"];

    Reset -> Reset [label="reset"];
    Reset -> Delay1 [label="!reset"];

    Delay1 -> Delay2;
    Delay2 -> Delay3;
    Delay3 -> WriteBuf;

    WriteBuf -> WriteBuf [label="buffer.addra < 1023"]
    WriteBuf -> EndWrite1 [label="buffer.addra == 1023"]

    EndWrite1 -> EndWrite2;
    EndWrite2 -> EndWrite3;
    EndWrite3 -> Wait;

    Wait -> Wait [label = "buffer_half == buffer.address_half"]
    Wait -> Delay1 [label = "buffer_half != buffer.address_half"]

}
