📄 sbox55.v
字号:
module sbox55(sin,sout);
input [0:5] sin;
output [0:3] sout;
reg [0:3] sout;
always @(sin)
begin
case ({sin[0],sin[5]})
2'b00:
case (sin[1:4])
4'h0: sout=4'h2;
4'h1: sout=4'hc;
4'h2: sout=4'h4;
4'h3: sout=4'h1;
4'h4: sout=4'h7;
4'h5: sout=4'ha;
4'h6: sout=4'hb;
4'h7: sout=4'h6;
4'h8: sout=4'h8;
4'h9: sout=4'h5;
4'ha: sout=4'h3;
4'hb: sout=4'hf;
4'hc: sout=4'hd;
4'hd: sout=4'h0;
4'he: sout=4'he;
4'hf: sout=4'h9;
endcase
2'b01:
case (sin[1:4])
4'h0: sout=4'he;
4'h1: sout=4'hb;
4'h2: sout=4'h2;
4'h3: sout=4'hc;
4'h4: sout=4'h4;
4'h5: sout=4'h7;
4'h6: sout=4'hd;
4'h7: sout=4'h1;
4'h8: sout=4'h5;
4'h9: sout=4'h0;
4'ha: sout=4'hf;
4'hb: sout=4'ha;
4'hc: sout=4'h3;
4'hd: sout=4'h9;
4'he: sout=4'h8;
4'hf: sout=4'h6;
endcase
2'b10:
case (sin[1:4])
4'h0: sout=4'h4;
4'h1: sout=4'h2;
4'h2: sout=4'h1;
4'h3: sout=4'hb;
4'h4: sout=4'ha;
4'h5: sout=4'hd;
4'h6: sout=4'h7;
4'h7: sout=4'h8;
4'h8: sout=4'hf;
4'h9: sout=4'h9;
4'ha: sout=4'hc;
4'hb: sout=4'h5;
4'hc: sout=4'h6;
4'hd: sout=4'h3;
4'he: sout=4'h0;
4'hf: sout=4'he;
endcase
2'b11:
case (sin[1:4])
4'h0: sout=4'hb;
4'h1: sout=4'h8;
4'h2: sout=4'hc;
4'h3: sout=4'h7;
4'h4: sout=4'h1;
4'h5: sout=4'he;
4'h6: sout=4'h2;
4'h7: sout=4'hd;
4'h8: sout=4'h6;
4'h9: sout=4'hf;
4'ha: sout=4'h0;
4'hb: sout=4'h9;
4'hc: sout=4'ha;
4'hd: sout=4'h4;
4'he: sout=4'h5;
4'hf: sout=4'h3;
endcase
endcase
end
endmodule
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -