【发布时间】:2020-04-09 08:52:43
【问题描述】:
我正在尝试在 FPGA 上实现遗传算法。为了生成算法的初始种群,我想通过开关制作一个带有用户输入的二维数组。但是,每次我编译它都说信号不是一个常数。我尝试过使用无效的整数和参数。我使用状态机来获取用户输入,然后计划将代码的遗传算法部分实例化到该模块中。下面是 GA 所在的模块。
module your_exam_module(clk, rst, a, b, c, d,e, start, done);
input clk, rst;
input [7:0]a;
input [7:0]b;
input [7:0]c;
input [7:0]d;
input [7:0]e;
input start;
output done;
reg done;
always @(posedge clk or negedge rst)
if (rst == 1'b0)
begin
done <= 1'b0;
end
else
begin
if (start == 1'b1)
begin
reg [e-1:0]population[b-1:0]; // generates an E by B register (matrix) that will serve as the initial population
done <= 1'b1;
end
end
endmodule
【问题讨论】:
-
代码现在在块中
标签: arrays variables 2d verilog genetic-algorithm