From 2a41afb7b2415f824ea1f60337050c9f41c0e33f Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Wed, 23 Jul 2014 21:34:14 +0200 Subject: [PATCH] Added RTLIL::SigSpec::repeat() --- kernel/rtlil.cc | 8 ++++++++ kernel/rtlil.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 7d031e174..d2f37cec4 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -1796,6 +1796,14 @@ void RTLIL::SigSpec::extend_u0(int width, bool is_signed) } +RTLIL::SigSpec RTLIL::SigSpec::repeat(int num) const +{ + RTLIL::SigSpec sig; + for (int i = 0; i < num; i++) + sig.append(*this); + return sig; +} + void RTLIL::SigSpec::check() const { if (packed()) diff --git a/kernel/rtlil.h b/kernel/rtlil.h index a13164c37..95de5f8c6 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -565,6 +565,8 @@ public: void extend(int width, bool is_signed = false); void extend_u0(int width, bool is_signed = false); + RTLIL::SigSpec repeat(int num) const; + bool operator <(const RTLIL::SigSpec &other) const; bool operator ==(const RTLIL::SigSpec &other) const; inline bool operator !=(const RTLIL::SigSpec &other) const { return !(*this == other); } -- 2.30.2