|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
小弟最近在写AES的加密模块,写了一个这样的状态机:always @(posedge iClk or negedge iReset)
begin
if(!iReset)
CS<=IDLE;
else
CS<=NS;
end
always @(posedge iClk)
begin
NS = 3'bx;
case(CS)
IDLE:
begin
iKey <= iInitialkey;
NS <= Round1;
keyValid <= 0;
end
Round1:
begin
totalkey[1279:1152] <= result;
NS <= Round2;
end
Round2:
begin
iKey <= totalkey[1279:1152];
totalkey[1151:1024] <= result;
NS <= Round3;
end
Round3:
begin
iKey <= totalkey[1151:1024];
totalkey[1023:896] <= result;
NS <= Round4;
end
Round4:
begin
iKey <= totalkey[1023:896];
totalkey[895:768] <= result;
NS <= Round5;
end
Round5:
begin
iKey <= totalkey[895:768];
totalkey[767:640] <= result;
NS <= Round6;
end
Round6:
begin
iKey <= totalkey[767:640];
totalkey[639:512] <= result;
NS <= Round7;
end
Round7:
begin
iKey <= totalkey[639:512];
totalkey[511:384] <= result;
NS <= Round8;
end
Round8:
begin
iKey <= totalkey[511:384];
totalkey[383:256] <= result;
NS <= Round9;
end
Round9:
begin
iKey <= totalkey[383:256];
totalkey[255:128] <= result;
NS <= Round10;
end
Round10:
begin iKey <= totalkey[255:128];
totalkey[127:0] <= result;
NS <= Output;
end
Output:
NS<=IDLE;
keyValid <= 1;
end
endcase
end
在quartus中综合用状态机工具查看,各个状态之间都是孤立的没有连线,请问这样的写法有什么问题吗?谢谢 |
|