module Ram(RamClk, CKE, CAS, RAS, WE, DQM, BA, A, DQ,
OpEnable, Addr, RdData, WrData, Ready);
input RamClk;
output CKE;
output logic CAS, RAS, WE;
output [1:0] DQM;
output logic [1:0] BA;
output logic [11:0] A;
inout [15:0] DQ;
input OpEnable;
output [23:0] Addr; //24 bits = 16 Mb
output [15:0] RdData;
input [15:0] WrData;
output Ready;
// code omitted here
wire CMD = {CAS,RAS,WE};
// code omitted here
//multiplexers
always @*
begin
if (InitDone == 0)
begin
CMD = InitCmd;
A = InitA;
BA = InitBA;
end
else
begin
//todo: assign the output of the main CMD, A and BA multiplexers
CMD = CMD_NOP;
A = 0;
BA = 0;
end
end
//rest of the module
RAS
,
CAS
,
WE
为了方便起见,我把它们组合成一条线,这样我就可以把命令值作为一个整体分配给它们。
现在我需要连接一个多路复用器到
CMD
为了方便我在一个街区里做。
我可以在单独的assign语句中使用三元表达式,在只有2个输入到多路复用器的情况下,但是让我们想象多路复用器有更多的输入,对于更多的输入,使用多个if/else或case语句看起来更方便,据我所知,我不能使用assign。
现在我有一个问题,我必须有一个关于LHS的注册
always
块,尽管在这种情况下它是组合逻辑,在这种情况下它不会推断寄存器。
命令
到
reg
中科院
,
瑞斯
和
我们
我可以替换
命令
中科院
瑞斯
和
我们
将它们作为一个整体
命令
模块参数。