【发布时间】:2017-03-15 10:38:06
【问题描述】:
我想在我的控制器中使用双向数据总线。这是代码
module controller ( clk, data_out);
// Port Declaration
input clk;
inout [7:0] data_out;
reg [7:0] a;
reg [7:0] b;
wire [7:0] c;
// data should write to data_out (data_out act as output)
task write;
input c;
begin
assign data_out = a;
data_out <= c;
end
endtask
// data should read from data_out (data_out act as input)
task read;
output b;
begin
assign data_out = 8'bz;
b <= data_out;
end
endtask
endmodule
当我编译这个时,我得到一个错误提示
程序连续赋值中的 LHS 可能不是网:data_out。
说assign data_out = a; 和assign data_out = 8'bz; 有错误
我知道分配应该在始终或初始块中完成,但在使用这些块的任务中是无用的/给 eroor
那么,我们如何在任务中改变公交车的方向呢?
【问题讨论】:
标签: task verilog bidirectional inout