build/sim: improve timebase calculation (strict checks) and update modules
[litex.git] / litex / build / sim / core / modules / serial2console / serial2console.c
index 114947f5f7587d4f0762189cd121e9bb9ad7c548..6780245252468bcbee646bd61060fdd4248944e3 100644 (file)
@@ -145,10 +145,11 @@ out:
   return ret;
 }
 
-static int serial2console_tick(void *sess) {
+static int serial2console_tick(void *sess, uint64_t time_ps) {
+  static struct clk_edge_t edge;
   struct session_s *s = (struct session_s*)sess;
 
-  if(*s->sys_clk == 0) {
+  if(!clk_pos_edge(&edge, *s->sys_clk)) {
     return RC_OK;
   }