LogicLoom
一个 Minecraft 模组,用于从 Verilog 设计创建逻辑电路和计算机。
教程
逻辑综合
确保已安装 Yosys。
首先用 Verilog 2001 编写所需的逻辑。
然后从此仓库获取 Synth.ys 脚本,并在文件顶部添加 read_verilog 命令以读取你的设计。
使用以下命令运行脚本:
yosys Synth.ys
输出的 JSON 文件将名为 mc_chip_maker.json,使用以下命令在 MC 中加载该文件:
`/logicloom load_json FILE_PATH
限制
不支持方向为 Inout 的端口。
JSON 文件必须只包含一个模块。仅读取第一个模块,其余将被忽略。
设置参数
放置步骤的最大迭代次数
`/logicloom param max_iter NUMBER_HERE
沿 X 轴和 Y 轴的放置区域大小
`/logicloom param chip_size NUMBER_HERE
放置期间扩散单元时使用的初始力乘数
应为较小的值。默认为 0.05
`/logicloom param force_const NUMBER_HERE
每次放置迭代时乘以力乘数的数值
应为较小的值。默认为 1.047
`/logicloom param force_mul NUMBER_HERE
当由于障碍物导致无法在两点和之间直接布线时,会使用波传播算法。
为了加速此算法,会根据这两个点构建一个边界框。波可以超出此框的最大距离为 router_max_search。
默认为 13
`/logicloom param router_max_search NUMBER_HERE
由 Yosys 生成的文件路径
`/logicloom load_json FILE_PATH
固定点
固定点与其他单元类似,但具有固定的位置。它们用于根据需要移动设计。
你需要至少添加一个固定点才能获得有用的结果。
目前,你只能添加附着于设计中每个单元的固定点。
设计中的所有端口都是附着于其连接单元的固定点,权重为 1。
固定点的位置是相对于当前起点存储的。
如果在添加固定点后更改了起点,则该固定点在游戏中的位置将会改变。
要修改固定点,请使用
/logicloom fixed_points
布局与布线 (P&R)
放置逻辑门
确保区域完全平坦,并且所有地面方块上都可以放置红石线和中继器。
`/logicloom place
放置导线
`/logicloom route
修复不良导线
目前,布线算法存在错误,因此可以运行此命令来检查损坏的导线。
此命令比较所有导线的起点,并检查两端是否功率相同。
如果不同,问题导线将在聊天中打印出来。如果有问题,通常很明显。
即使所有内容看似正常工作,此命令也能找到不良导线,因为这些不良导线可能尚未影响输出。
你必须等待所有信号传播完毕,否则会得到错误结果。
你可以使用 /tick sprint 来加速这一过程。
`/logicloom misc check_wires
为了确保检查所有导线,你可以使用此命令强制所有导线处于以下状态:
-
通电
`/logicloom misc force_power_wire ON
-
断电
`/logicloom misc force_power_wire OFF
-
恢复为正常状态
`/logicloom misc force_power_wire Normal
运行此命令后,请运行 check_wires 命令。
画廊

一台可以进行加法、减法、乘法和除法的 8 位计算器。
LogicLoom
A Minecraft mod for creating logic circuits and computers from Verilog designs.
Tutorial
Logic synthesis
Make sure you have installed Yosys.
First write the desired logic in Verilog 2001.
Then take the Synth.ys script from this repo and add read_verilog commands to the top of the file to read your design.
Run the script with
yosys Synth.ys
The output JSON will be called mc_chip_maker.json load this file into MC using
`/logicloom load_json FILE_PATH
Limitations
Ports with Inout as direction are unsupported.
The JSON file must only have one module. Only the first module is read all others are ignored.
Setup parameters
Maximum Iterations for the placement step
`/logicloom param max_iter NUMBER_HERE
Size of the placement area along X and Y axis
`/logicloom param chip_size NUMBER_HERE
Force initial force multiplier used during spreading cells during placement
Should be a small value. Default is 0.05
`/logicloom param force_const NUMBER_HERE
Number by which to multiply the force multiplier every placement iteration
Should be a small value. Default is 1.047
`/logicloom param force_mul NUMBER_HERE
When a straight wire between two point can't be run because of obstacles. A wave propagation algorithm is used.
In order to sped up this algorithm a bounding box is constructed using the two points. The wave can go outside this box by a maximum of router_max_search.
Default is 13
`/logicloom param router_max_search NUMBER_HERE
Path to the file made by Yosys
`/logicloom load_json FILE_PATH
Fixed points
Fixed points are like other cells, but they have a fixed position. They are used to move the design as needed.
You will need to add at least one fixed point in order to get useful results.
Currently, you can only add fixed points that are attached to every cell in the design.
All ports in a design are a fixed point attached to the cells they are connected to with weights of 1.
Position of fixed point is stored relative to the current starting point.
If the starting point is changed after a fixed point is added the position of that fixed point in the world will change.
To modify fixed points use
/logicloom fixed_points
P&R
Place the logic gates
Make sure that the area is completely flat and on all ground blocks redstone wire and repeaters can be placed.
`/logicloom place
Place the Wires
`/logicloom route
Fixing bad wires
Currently, the wire placing algorithm has bugs so run this command can be used to check for broken wires
This command compares starting point of all wires and checks if the power is the same at all ends.
If not problematic ones are printed in the chat. If there are any issues they are usually obvious.
This command can find bad wires even if everything appears to behave correctly as those bad wires might not be currently affecting the output.
You must wait for all signals to propagate otherwise you will get bad results.
You can speed this up with /tick sprint
`/logicloom misc check_wires
To make sure all wire are checked you can use this command to force all wire to be
-
Powered
`/logicloom misc force_power_wire ON
-
Unpowered
`/logicloom misc force_power_wire OFF
-
Returned to the normal state
`/logicloom misc force_power_wire Normal
After running this command run the check_wires command.
Gallery

An 8-bit calculator that can do addition, subtraction, multiplication and division.
评论 0
登录后参与评分
还没有评论,来抢沙发吧