@@ -1837,7 +1837,8 @@ def read(self, fsm, global_addr):
18371837 fsm .If (ack ).goto_next ()
18381838
18391839 # state 1
1840- fsm .goto_next ()
1840+ done = vtypes .Ands (self .raddr .arvalid , self .raddr .arready )
1841+ fsm .If (done ).goto_next ()
18411842
18421843 # state 2
18431844 rcond = fsm .here
@@ -1863,7 +1864,8 @@ def write(self, fsm, global_addr, value):
18631864 fsm .If (ack ).goto_next ()
18641865
18651866 # state 1
1866- fsm .goto_next ()
1867+ done = vtypes .Ands (self .waddr .awvalid , self .waddr .awready )
1868+ fsm .If (done ).goto_next ()
18671869
18681870 # state 2
18691871 wcond = fsm .here
@@ -1872,13 +1874,18 @@ def write(self, fsm, global_addr, value):
18721874 ack = vtypes .Ors (self .wdata .wready , vtypes .Not (self .wdata .wvalid ))
18731875 fsm .If (ack ).goto_next ()
18741876
1875- def write_fence ( self , fsm , global_addr , value ):
1876-
1877- self . write ( fsm , global_addr , value )
1877+ # state 3
1878+ done = vtypes . Ands ( self . wdata . wvalid , self . wdata . wready )
1879+ fsm . If ( done ). goto_next ( )
18781880
1881+ # state 4
18791882 res = self .write_completed ()
18801883 fsm .If (res ).goto_next ()
18811884
1885+ def write_fence (self , fsm , global_addr , value ):
1886+ """ AXI-Lite Master must not issue any request until the previous request is completed."""
1887+ self .write (fsm , global_addr , value )
1888+
18821889 def set_global_base_addr (self , fsm , addr ):
18831890
18841891 if not self .use_global_base_addr :
@@ -1909,12 +1916,16 @@ def read_delayed(self, fsm, global_addr, delay):
19091916 fsm .If (ack ).goto_next ()
19101917
19111918 # state 1
1919+ done = vtypes .Ands (self .raddr .arvalid , self .raddr .arready )
1920+ fsm .If (done ).goto_next ()
1921+
1922+ # state 2
19121923 fsm .If (delay_count > 0 )(
19131924 delay_count .dec ()
19141925 )
19151926 fsm .If (delay_count == 0 ).goto_next ()
19161927
1917- # state 2
1928+ # state 3
19181929 rcond = fsm .here
19191930 rdata = self .m .TmpReg (self .datawidth , initval = 0 ,
19201931 signed = True , prefix = 'axim_rdata' )
@@ -1942,14 +1953,26 @@ def write_delayed(self, fsm, global_addr, value, delay):
19421953 fsm .If (ack ).goto_next ()
19431954
19441955 # state 1
1956+ done = vtypes .Ands (self .waddr .awvalid , self .waddr .awready )
1957+ fsm .If (done ).goto_next ()
1958+
1959+ # state 2
19451960 fsm .If (delay_count > 0 )(
19461961 delay_count .dec ()
19471962 )
19481963 fsm .If (delay_count == 0 ).goto_next ()
19491964
1950- # state 2
1965+ # state 3
19511966 wcond = fsm .here
19521967 wdata = value
19531968 _ = self .write_data (wdata , cond = wcond )
19541969 ack = vtypes .Ors (self .wdata .wready , vtypes .Not (self .wdata .wvalid ))
19551970 fsm .If (ack ).goto_next ()
1971+
1972+ # state 4
1973+ done = vtypes .Ands (self .wdata .wvalid , self .wdata .wready )
1974+ fsm .If (done ).goto_next ()
1975+
1976+ # state 5
1977+ res = self .write_completed ()
1978+ fsm .If (res ).goto_next ()
0 commit comments