Verilog SV中的Gauss-Seidel实型松弛

Verilog SV中的Gauss-Seidel实型松弛,verilog,system-verilog,Verilog,System Verilog,对于行为模型(不需要合成),我使用循环回路。 所有变量都是real类型,所有操作都在同一个时隙上运行 下面的简单示例可在上找到: 电路收敛到稳定状态: top.fun1: in = 0, out = 0 top.fun2: in = 0, out = 0 top.fun1: in = 0.2, out = 0.1 top.fun2: in = 0.2, out = 0.

对于行为模型(不需要合成),我使用循环回路。 所有变量都是real类型,所有操作都在同一个时隙上运行

下面的简单示例可在上找到:

电路收敛到稳定状态:

top.fun1:     in =        0, out =        0
top.fun2:     in =        0, out =        0
top.fun1:     in =      0.2, out =      0.1
top.fun2:     in =      0.2, out =      0.1
top.fun1:     in =     0.24, out =     0.12
top.fun2:     in =     0.24, out =     0.12
...
top.fun1:     in =     0.25, out =    0.125
top.fun2:     in =     0.25, out =    0.125
在松弛期间,在对实例fun1求值之后,将对实例fun2求值,但尚未使用刚刚更改的输入。 这对应于高斯-雅可比式运算

对于硬件来说,这种并行行为是完全合理的,否则可能导致竞争条件。 但对于上述行为模型,最好采用高斯-赛德尔模式:

top.fun1:     in =        0, out =        0
top.fun2:     in =        0, out =      0.1
top.fun1:     in =      0.1, out =     0.11
top.fun2:     in =     0.21, out =    0.121
top.fun1:     in =    0.231, out =   0.1231
...
top.fun2:     in =     0.25, out =    0.125
为了序列化模拟流,可以插入输入延迟,
但我想知道在多模块环境中是否有更具原则性的方法来实现这一点。

在SystemVerilog中引入排序只有两种方法

  • 编写程序代码,就像在软件中一样,在开始/结束块之间放置语句
  • 使用延迟或时钟对过程代码的执行进行排序 当然,硬件设计是这两种模式的结合。即使在SystemVerilog中编写行为模型时也是如此

    顺便说一句,您的代码可以通过以下方式简化:

    module sum(input real in1, in2, output real out);
      always_comb begin
        out = in1 + in2;
      end 
    endmodule
    
    module sum(input real in1, in2, output real out);
      always_comb begin
        out = in1 + in2;
      end 
    endmodule