Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Vector sFindFirst documentation to correctly match return type #243

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions source/SpinalHDL/Data types/Vec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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


Expand Down
9 changes: 6 additions & 3 deletions source/locale/gettext/SpinalHDL/Data types/Vec.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -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
Expand Down
63 changes: 35 additions & 28 deletions source/locale/zh_CN/LC_MESSAGES/SpinalHDL/Data types/Vec.po
Original file line number Diff line number Diff line change
@@ -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 "
"<EMAIL@ADDRESS>Language:zh_CNLanguage-Team:zh_CN <[email protected]>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 <EMAIL@ADDRESS"
">Language-Team:LANGUAGE <[email protected]>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 <EMAIL@ADDRESS>Language:zh_CNLanguage-Team:zh_CN "
"<[email protected]>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 "
"<EMAIL@ADDRESS>Language-Team:LANGUAGE <[email protected]>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 <[email protected]>\n"
"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/"
"spinaldoc-rtd/spinalhdldata-typesvec/zh_Hans/>\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) <https://hosted.weblate.org/projects"
"/spinaldoc-rtd/spinalhdldata-typesvec/zh_Hans/>\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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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"

Expand Down Expand Up @@ -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)"
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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)"

Loading