|
DES加密系统整体设计顶层
综上所述,DES加密系统整体设计顶层框图如下:
图1 整体设计顶层框图
DES加密系统顶层设计模块的源代码:
module top( clk, TX_ reset, RX_reset, RXD, TXD, RX, RX_done, TX_ena, DECRYPT, CLKLXENABLE,Display, Control);
input clk;
input TX_ reset:
input RX_reset:
//input DES_ reset;
input RXD;
input RX;
input TX_ena;
input DECRYPT;
output TXD:
output RX_done;
output CLKLXENABLE;
output [6:0] Display;
output [3:0] Control;
//output flag;
reg [6:0] Display;
reg [3:0] Control;
reg [1:0] LED_ Flag;
//reg flag;
wire [7:0] SENDDATA;
wire [7:0] DOUT;
wire [] DATAREADY;
wire [11:0] FRAME_COUNTER;
wire [11:0] DISPLAY_COUNTER;
wire E_DATA_RDY;
wire [63:0] DATA_IN64;
wire [63:0] DATA_OUT64;
wire rstn;
wire [7:0] DIN;
wire [11:0] TOTAL_FRAME;
wire [8:0] RAM_ADDR;
wire [8:0] BLOCK_COUNTER;
wire MODESEL;
wire DATA_IN64_EN;
wire [63:0] TEST_OUT_REG;
//wire DES_reset_buf;
assign E_DATA_ RDY=1' b 1;
assign DIN[7:0]= { DOUT[0],DOUT[1],DOUT[2],DOUT[3],DOUT[4],DOUT[5],DOUT[6],DOUT [ 7]};
assign RAMADDR=FRAME_COUNTER[11:3];
assign LED4=4' b0000;
//assign RAM_ADDR=FRAME_COUNTER[11:3];
assign MODESEL=1' b 1;
assign DISPLAY_COUNTER=RX?(FRAME_COUNTER+1)FRAME_COUNTER-8); pram
Ipram(.clk(clk),.clk_slow(CLK16X),.data_in8(DIN),.data_in64(DATA_IN64),.modesel(MODESEL),.data_in8_ en(DATAREADY),.data_in64_ en(DATA_IN64_ EN),.addr_a(FRAME_COUNTER[11:3]),.addr_b(BLOCK_COUNTER),.ramsel(FRAME_COUNTER[2:0]),.data_ out8 (SENDDATA[7:0]),.data out64(DATA_OUT64));
//IBUF rstpad(.I(DES_ reset),.O(DES_reset_ buf));
uartnew
Iuartnew(.RX(RX),.senddata(SENDDATA),.sendenable(TX_ena),.dout(DOUT),.dataready(DATAREADY),.rxd(RXD),.txd(TXD),.stdclk(clk),.rst(RX_reset),.rst2(TX_reset),.frame_counter(FRAME_COUNTER[11:0]),.RX_done(RX_done),.test(CLKLXENABLE),.total_frame(TOTALFRAME),.clkl6x (CLK16X));
des
Ides(.reset(RX),.clk (clk),.data_ bus (DATA_OUT64),.TEST_OUT (TEST_OUT_REG),.e_data_rdy(E_DATA_RDY),.key(DATA_OUT64),.decrypt(DECRYPT),.data out(DATA_IN64),.d_ data_ rdy(DATA_IN64_ EN),.block_ counter (BLOCK_ COUNTER),.total_block(TOTAI-FRAME[11:3]));
//always @(posedge clk)
// begin
// if (DES_ reset_ buf)
// flag<=0' b0;
// else
// flag<=0' b 1;
// end
/*********七段数码管显示***********/
/*********译码部分**************/
wire[6:0] DisplayAl,DisplayA2,DisplayBl,DisplayB2;
HEX2LED myHLAl(DISPLAY_COUNTER[3:0],DisplayAl);
HEX2LED myHLA2(DISPLAY_COUNTER[7:4],DisplayA2);
HEX2LED myHLBl(DISPLAY一OUNTER[11:8],DisplayBl);
HEX2LED myHLB2(LED4,DisplayB2);
/*******为七段码显示生成一个快时钟********/
wire clk_ LED;
wire [25:0] time_ seed;
assign time_seed=26' d50000; //综合下载时 d=26' d25_ 000_ 000;
assign rstn=RX_reset; //仿真时assign d=26' d00_ 005;
Freq_Div myFreq_Div(
.Clk_sys(clk),
.Div(time_seed),
.Reset (rstn),
.Clk_user(clk_ LED)
);
/********七段码输出控制状态机*************/
always@(posedge clk_LED or negedge rstn)
begin
if(!rstn)
begin
Display<=0;
Control<=0;
LED_ Flag<=0;
end
else
begin
if(LED_Flag===2' b00)
begin
Display<=DisplayAl:
Control<=4' b0111;
LED Flag<=2' b01;
end
else if(LED_Flag==2' b01)
begin
Display<=DisplayA2;
Control<=4' b1011;
LEDes Flag<=2' b 10;
end
else if(LED_Flag==2' b10)
begin
Display<=DisplayBl;
Control<=4' b1101;
LEDes Flag<=2' b 11;
end
else if(LED_Flag====2' b 11)
begin
Display<=DisplayB2;
Control<=4' b1110;
LED_ Flag<=2' b00;
end
else
LED_Flag<=2' b00;
end
end
endmodule
DES加密系统顶层设计中,des. v, pram. v, uartnew. v, FrecLDiv. v, HEX2LED. v为系统调用函数。
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?我要注册
x
|