From: Luke Kenneth Casson Leighton Date: Tue, 28 Jul 2020 10:35:49 +0000 (+0100) Subject: move "wrap" function into nmutil.util X-Git-Tag: 24jan2021_ls180~32 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=041ccc4e5e4aa0de32670c438bbdacdf8a970adf;p=nmutil.git move "wrap" function into nmutil.util --- diff --git a/src/nmutil/util.py b/src/nmutil/util.py index b8f1ce4..3aae6ef 100644 --- a/src/nmutil/util.py +++ b/src/nmutil/util.py @@ -34,3 +34,15 @@ def eq32(is_32bit, dest, src): dest[32:64].eq(Mux(is_32bit, 0, src[32:64]))] +# a wrapper function formerly in run_simulation that is still useful. +# Simulation.add_sync_process now only takes functions, it does not +# take generators. so passing in arguments is no longer possible. +# with this wrapper, the following is possible: +# sim.add_sync_process(wrap.dut(parallel_sender_number=0)) +# sim.add_sync_process(wrap.dut(parallel_sender_number=1)) + +def wrap(process): + def wrapper(): + yield from process + return wrapper +