如何在顶层对inout数据仲裁?
时间:10-02
整理:3721RD
点击:
本人在设计中遇到一个问题,底层几个模块Data信号均为inout,顶层中对各个模块的Data信号进行仲裁,但在实际检测中发现Data总线只能输出数据,不能输入数据,请高手指点下问题出在哪里,谢谢各位~~下面是相关的代码:
顶层仲裁:
reg [9:0] rAddr;
reg [2:0] rCmd;
reg [7:0] rData;
always @ (*)
if(IsInitSta) begin rAddr = Addr_U2;rData = Data_U2;rCmd = Cmd_U2;end
else if(IsSockSta) begin rAddr = Addr_U3;rData = Data_U3;rCmd = Cmd_U3;end
else if(rx_sta) begin rAddr = Addr_U4;rData = Data_U4;rCmd = Cmd_U4;end
else if(tx_sta) begin rAddr = Addr_U5;rData = Data_U5;rCmd = Cmd_U5;end
else begin rAddr = 10'bxxxxxxxxxx;rData = 8'bxxxxxxxx;rCmd = 3'bxxx; end
//------------------------------------------------------------------------------
assign Data = rData;
assign Addr = rAddr;
assign Cmd = rCmd;
//----------------------------------------------------------------------------------------------------------------------------
各模块下的定义:
wire [7:0] Data_in;
reg [7:0] Data_out;
assign Data_in = Data ;
assign Data = isOut ? Data_out : 8'bzzzzzzzz;
顶层仲裁:
reg [9:0] rAddr;
reg [2:0] rCmd;
reg [7:0] rData;
always @ (*)
if(IsInitSta) begin rAddr = Addr_U2;rData = Data_U2;rCmd = Cmd_U2;end
else if(IsSockSta) begin rAddr = Addr_U3;rData = Data_U3;rCmd = Cmd_U3;end
else if(rx_sta) begin rAddr = Addr_U4;rData = Data_U4;rCmd = Cmd_U4;end
else if(tx_sta) begin rAddr = Addr_U5;rData = Data_U5;rCmd = Cmd_U5;end
else begin rAddr = 10'bxxxxxxxxxx;rData = 8'bxxxxxxxx;rCmd = 3'bxxx; end
//------------------------------------------------------------------------------
assign Data = rData;
assign Addr = rAddr;
assign Cmd = rCmd;
//----------------------------------------------------------------------------------------------------------------------------
各模块下的定义:
wire [7:0] Data_in;
reg [7:0] Data_out;
assign Data_in = Data ;
assign Data = isOut ? Data_out : 8'bzzzzzzzz;