From 283b8ca081c0ef793bfcfe059db0af8c9323c7c8 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Sat, 15 Aug 2020 15:50:36 +0200 Subject: [PATCH] Commit the missing commons --- fpga/common.dg | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 fpga/common.dg diff --git a/fpga/common.dg b/fpga/common.dg new file mode 100644 index 0000000..7257d4e --- /dev/null +++ b/fpga/common.dg @@ -0,0 +1,13 @@ +import "/nmigen_dg/*" + +# result = pipeline 5 +# bind (+) 1 +# bind (-) 5 +pipeline = data *: funcs -> data where + for func in funcs => + data = func data + +# cast to signed, extending the signal by one bit +to_signed = signal -> out where + out = Signal$ signed (signal.width + 1) + Comb$ out :== signal