BSV_Tutorial_cn
BSV_Tutorial_cn copied to clipboard
一篇全面的 Bluespec SystemVerilog (BSV) 中文教程,介绍了BSV的调度、FIFO数据流、多态等高级特性,展示了BSV相比于传统Verilog开发的优势。
官方预定义的模块,其method是有调度注解来约束的。rule也可以用调度Attribute来约束。 但是我在定义一个模块时,不知道如何来表示对其method的约束: 比如我定义了一个模块,有两个method,我期望这两个method不能在同一周期调用(类似调度注解中的C); 或者两个method,我期望同时有rules想要调用时,其中一个的urgency更高(类似rule的descending_urgency); 或者我想规定某个method的urgency永远高于模块内的某个rule。 我发现好像没有办法在定义模块的时候就定义这些约束,好像只能在更高层模块实例化时,规定调用这些method的rule的约束。 但是这样没法在模块定义package中表现出想要的约束,并且每次调用都要写一个attribute。 想请教一下,有没有什么好的解决方法?或者我的理解和使用方式是否有误?
在 https://github.com/B-Lang-org/bsc/releases 就可以下载到,按照3.1描述的安装方法实测可用。(同时除了Linux和WSL,macOS也可以使用)
在for循环中展开的rule要如何指定descending_urgency。比如说下面的一个程序,这个程序是将输入的数从小到大排好了序再输出,但是在编译的时候发现for循环里面写的rule发生冲突,虽然说编译器会自动帮我们指定descending_urgency,但是想问一下有没有比较方便的在for循环里面手动指定descending_urgency的方法。 报warning如下: ``` $ bsvbuild.sh -bs mkTestbench Testbench.bsv top module: mkTestbench top file : Testbench.bsv bsc -sim -p +: -g mkTestbench -u Testbench.bsv checking package dependencies compiling ./Utils.bsv compiling ./Bubblesort.bsv...
https://github.com/WangXuan95/BSV_Tutorial_cn/blob/0df1a11e3f765de61824226ab78e84f8b6a4c72b/README.md?plain=1#L6484
https://github.com/WangXuan95/BSV_Tutorial_cn/blob/0df1a11e3f765de61824226ab78e84f8b6a4c72b/README.md?plain=1#L5567 bsv-reference-guide 中 Log#(n1,n2) // Meaning: assert ceiling(log(n1)) = n2 这里说"至少",似乎不太明确。 还有下面 TLog#(n) bsv-reference-guide 中 TLog#(n1) // Calculate ceiling log2(n1) 按照 log2(n-1)+1 计算的话 表 21 中,n 的值等于 1 的时候,结果似乎不对
https://github.com/WangXuan95/BSV_Tutorial_cn/blob/0df1a11e3f765de61824226ab78e84f8b6a4c72b/README.md?plain=1#L5453
https://github.com/WangXuan95/BSV_Tutorial_cn/blob/0df1a11e3f765de61824226ab78e84f8b6a4c72b/README.md?plain=1#L5110
https://github.com/WangXuan95/BSV_Tutorial_cn/blob/0df1a11e3f765de61824226ab78e84f8b6a4c72b/README.md?plain=1#L4558
https://github.com/WangXuan95/BSV_Tutorial_cn/blob/0df1a11e3f765de61824226ab78e84f8b6a4c72b/README.md?plain=1#L3170
https://github.com/WangXuan95/BSV_Tutorial_cn/blob/0df1a11e3f765de61824226ab78e84f8b6a4c72b/README.md?plain=1#L2992