diff --git a/source/SpinalHDL/Data types/Vec.rst b/source/SpinalHDL/Data types/Vec.rst index b3e0276ec08..a63020a3484 100644 --- a/source/SpinalHDL/Data types/Vec.rst +++ b/source/SpinalHDL/Data types/Vec.rst @@ -159,8 +159,8 @@ Lib helper functions - Check if there is an element with a given value present in the Vec. - Bool * - x.sFindFirst(condition: T => Bool) - - Find the first element matching the given condition in the Vec, return the index of that element. - - UInt + - Find the first element matching the given condition in the Vec, return if any index was successfully found and the index of that element. + - (Bool, UInt) * - x.reduceBalancedTree(op: (T, T) => T) - Balanced reduce function, to try to minimize the depth of the resulting circuit. ``op`` should be commutative and associative. - T @@ -183,7 +183,7 @@ Lib helper functions val b1: Bool = vec1.sExists(_ > 250) // is there a element bigger than 250 val b2: Bool = vec1.sContains(0) // is there a zero in vec - val u1: UInt = vec1.sFindFirst(_ < 10) // get the index of the first element lower than 10 + val (u1Found, u1): (Bool, UInt) = vec1.sFindFirst(_ < 10) // get the index of the first element lower than 10 val u2: UInt = vec1.reduceBalancedTree(_ + _) // sum all elements together diff --git a/source/locale/gettext/SpinalHDL/Data types/Vec.pot b/source/locale/gettext/SpinalHDL/Data types/Vec.pot index f7dfbb7c195..34930422340 100644 --- a/source/locale/gettext/SpinalHDL/Data types/Vec.pot +++ b/source/locale/gettext/SpinalHDL/Data types/Vec.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: SpinalHDL \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-02 16:09+0000\n" +"POT-Creation-Date: 2024-02-13 17:23+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -172,7 +172,6 @@ msgstr "" #: ../../SpinalHDL/Data types/Vec.rst:151 #: ../../SpinalHDL/Data types/Vec.rst:154 -#: ../../SpinalHDL/Data types/Vec.rst:163 msgid "UInt" msgstr "" @@ -205,7 +204,11 @@ msgid "x.sFindFirst(condition: T => Bool)" msgstr "" #: ../../SpinalHDL/Data types/Vec.rst:162 -msgid "Find the first element matching the given condition in the Vec, return the index of that element." +msgid "Find the first element matching the given condition in the Vec, return if any index was successfully found and the index of that element." +msgstr "" + +#: ../../SpinalHDL/Data types/Vec.rst:163 +msgid "(Bool, UInt)" msgstr "" #: ../../SpinalHDL/Data types/Vec.rst:164 diff --git a/source/locale/zh_CN/LC_MESSAGES/SpinalHDL/Data types/Vec.po b/source/locale/zh_CN/LC_MESSAGES/SpinalHDL/Data types/Vec.po index d6131e968bb..8e3d06f0cb0 100644 --- a/source/locale/zh_CN/LC_MESSAGES/SpinalHDL/Data types/Vec.po +++ b/source/locale/zh_CN/LC_MESSAGES/SpinalHDL/Data types/Vec.po @@ -1,23 +1,26 @@ + msgid "" msgstr "" -"Project-Id-Version: SpinalHDLReport-Msgid-Bugs-To:POT-Creation-Date:2023-12-" -"01 11:48+0800PO-Revision-Date:YEAR-MO-DA HO:MI+ZONELast-Translator:FULL NAME " -"Language:zh_CNLanguage-Team:zh_CN Plural-" -"Forms:nplurals=1; plural=0;MIME-Version:1.0Content-Type:text/plain; " -"charset=UTF-8\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESSPOT-Creation-Date:2023-12-02 00:23+0800PO-" -"Revision-Date:YEAR-MO-DA HO:MI+ZONELast-Translator:FULL NAME Language-Team:LANGUAGE MIME-Version:1.0Content-Type:text/plain; " -"charset=UTF-8\n" +"Project-Id-Version: SpinalHDLReport-Msgid-Bugs-To:POT-Creation-" +"Date:2023-12-01 11:48+0800PO-Revision-Date:YEAR-MO-DA HO:MI+ZONELast-" +"Translator:FULL NAME Language:zh_CNLanguage-Team:zh_CN " +"Plural-Forms:nplurals=1; plural=0;MIME-Version:1.0Content-" +"Type:text/plain; charset=UTF-8\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESSPOT-Creation-Date:2023-12-02 00:23" +"+0800PO-Revision-Date:YEAR-MO-DA HO:MI+ZONELast-Translator:FULL NAME " +"Language-Team:LANGUAGE MIME-Version:1.0Content-" +"Type:text/plain; charset=UTF-8\n" +"POT-Creation-Date: 2024-02-13 17:23+0000\n" "PO-Revision-Date: 2023-12-14 06:03+0000\n" "Last-Translator: Readon \n" -"Language-Team: Chinese (Simplified) \n" "Language: zh_CN\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bitGenerated-By:Babel 2.13.1\n" +"Language-Team: Chinese (Simplified) \n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 5.3-rc\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.14.0\n" #: ../../SpinalHDL/Data types/Vec.rst:7 msgid "Vec" @@ -30,10 +33,9 @@ msgstr "描述" #: ../../SpinalHDL/Data types/Vec.rst:12 msgid "" -"A ``Vec`` is a composite type that defines a group of indexed signals (of " -"any SpinalHDL basic type) under a single name." -msgstr "``Vec`` 是一种复合类型,它在一个变量中定义一组可索引的信号(任何 SpinalHDL " -"基本类型)。" +"A ``Vec`` is a composite type that defines a group of indexed signals (of" +" any SpinalHDL basic type) under a single name." +msgstr "``Vec`` 是一种复合类型,它在一个变量中定义一组可索引的信号(任何 SpinalHDL 基本类型)。" #: ../../SpinalHDL/Data types/Vec.rst:15 types/Vec.rst:23 msgid "Declaration" @@ -155,7 +157,8 @@ msgstr "库辅助函数" #: ../../SpinalHDL/Data types/Vec.rst:140 msgid "" -"You need to import ``import spinal.lib._`` to put these functions in scope." +"You need to import ``import spinal.lib._`` to put these functions in " +"scope." msgstr "您需要以 ``import spinal.lib._`` 导入库,以将这些函数置于作用域中。" #: ../../SpinalHDL/Data types/Vec.rst:149 @@ -166,7 +169,7 @@ msgstr "x.sCount(condition: T => Bool)" msgid "Count the number of occurence matching a given condition in the Vec." msgstr "计算 Vec 中与给定条件匹配的次数。" -#: ../../SpinalHDL/Data types/Vec.rst:151 types/Vec.rst:154 types/Vec.rst:163 +#: ../../SpinalHDL/Data types/Vec.rst:151 types/Vec.rst:154 msgid "UInt" msgstr "UInt" @@ -199,11 +202,16 @@ msgid "x.sFindFirst(condition: T => Bool)" msgstr "x.sFindFirst(condition: T => Bool)" #: ../../SpinalHDL/Data types/Vec.rst:162 +#, fuzzy msgid "" -"Find the first element matching the given condition in the Vec, return the " -"index of that element." +"Find the first element matching the given condition in the Vec, return if" +" any index was successfully found and the index of that element." msgstr "查找 Vec 中与给定条件匹配的第一个元素,返回该元素的索引。" +#: ../../SpinalHDL/Data types/Vec.rst:163 +msgid "(Bool, UInt)" +msgstr "" + #: ../../SpinalHDL/Data types/Vec.rst:164 msgid "x.reduceBalancedTree(op: (T, T) => T)" msgstr "x.reduceBalancedTree(op: (T, T) => T)" @@ -212,8 +220,7 @@ msgstr "x.reduceBalancedTree(op: (T, T) => T)" msgid "" "Balanced reduce function, to try to minimize the depth of the resulting " "circuit. ``op`` should be commutative and associative." -msgstr "具有自动平衡功能的reduce函数,尽量减少生成电路的深度。 ``op`` " -"应该是具有可交换性和可结合性的。" +msgstr "具有自动平衡功能的reduce函数,尽量减少生成电路的深度。 ``op`` 应该是具有可交换性和可结合性的。" #: ../../SpinalHDL/Data types/Vec.rst:166 msgid "T" @@ -224,8 +231,7 @@ msgid "x.shuffle(indexMapping: Int => Int)" msgstr "x.shuffle(indexMapping: Int => Int)" #: ../../SpinalHDL/Data types/Vec.rst:168 -msgid "" -"Shuffle the Vec using a function that maps the old indexes to new ones." +msgid "Shuffle the Vec using a function that maps the old indexes to new ones." msgstr "使用将旧索引映射到新索引的函数对 Vec 进行混洗(shuffle)。" #: ../../SpinalHDL/Data types/Vec.rst:169 @@ -234,9 +240,10 @@ msgstr "Vec[T]" #: ../../SpinalHDL/Data types/Vec.rst:191 msgid "" -"The sXXX prefix is used to disambiguate with respect to identically named " -"Scala functions that accept a lambda function as argument." +"The sXXX prefix is used to disambiguate with respect to identically named" +" Scala functions that accept a lambda function as argument." msgstr "sXXX 前缀用于消除使用 lambda 函数作为参数的同名 Scala 函数带来的歧义。" #~ msgid "Vec(type: Data, size: Int)" #~ msgstr "Vec(类型:数据,大小:Int)" +