⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 block8s.v

📁 脉动乘法器:一个GF(2m)域上的Digit-Serial 脉动结构(Systolic)的乘法器
💻 V
字号:

//////////////////////////////////////////////////////////////////////////////////////
//	Name					8 Bit Block                                                       //
//	Version				1.0																															  //
//	Author				Marko																															//
//	Date					Dec 12																														//
//	Character			Gate level description                				                    //
//	Changes				Original Version                                                  //
//////////////////////////////////////////////////////////////////////////////////////

module Block8s (ai, bi, gi, ti1, ti2, ti3, ao, go, to1, to2);
input [7:0] ai, bi, gi, ti1, ti2;
input [7:1] ti3;
output[7:0] ao, go, to1;
output[6:0] to2;
wire        w07, w06, w05, w04, w03, w02, w01, w00;
wire        w17, w16, w15, w14, w13, w12, w11, w10;
wire        w27, w26, w25, w24, w23, w22, w21, w20;
wire        w37, w36, w35, w34, w33, w32, w31, w30;
wire        w47, w46, w45, w44, w43, w42, w41, w40;
wire        w57, w56, w55, w54, w53, w52, w51, w50;
wire        w67, w66, w65, w64, w63, w62, w61, w60;
wire        w77, w76, w75, w74, w73, w72, w71, w70;

//cell矩阵按照纵向方式从右到左排列

cell3 u_cell3_00 (.ai(ai[0]), .bi(bi[7]), .gi(gi[0]), .ti1(ti1[7]), .ti2(ti2[0]), .to(w00));
cell2 u_cell2_10 (.ai(ai[0]), .bi(bi[6]), .gi(gi[0]), .ti1(ti1[6]), .to(w10));
cell2 u_cell2_20 (.ai(ai[0]), .bi(bi[5]), .gi(gi[0]), .ti1(ti1[5]), .to(w20));
cell2 u_cell2_30 (.ai(ai[0]), .bi(bi[4]), .gi(gi[0]), .ti1(ti1[4]), .to(w30));
cell2 u_cell2_40 (.ai(ai[0]), .bi(bi[3]), .gi(gi[0]), .ti1(ti1[3]), .to(w40));
cell2 u_cell2_50 (.ai(ai[0]), .bi(bi[2]), .gi(gi[0]), .ti1(ti1[2]), .to(w50));
cell2 u_cell2_60 (.ai(ai[0]), .bi(bi[1]), .gi(gi[0]), .ti1(ti1[1]), .to(w60));
cell2 u_cell2_70 (.ai(ai[0]), .bi(bi[0]), .gi(gi[0]), .ti1(ti1[0]), .to(w70));

cell4 u_cell4_01 (.ai(ai[1]), .bi(bi[7]), .gi(gi[1]), .ti1(ti1[7]), .ti2(ti2[1]), .ti3(ti3[1]), .to(w01));
cell3 u_cell3_11 (.ai(ai[1]), .bi(bi[6]), .gi(gi[1]), .ti1(ti1[6]), .ti2(w00), .to(w11));
cell3 u_cell3_21 (.ai(ai[1]), .bi(bi[5]), .gi(gi[1]), .ti1(ti1[5]), .ti2(w10), .to(w21));
cell3 u_cell3_31 (.ai(ai[1]), .bi(bi[4]), .gi(gi[1]), .ti1(ti1[4]), .ti2(w20), .to(w31));
cell3 u_cell3_41 (.ai(ai[1]), .bi(bi[3]), .gi(gi[1]), .ti1(ti1[3]), .ti2(w30), .to(w41));
cell3 u_cell3_51 (.ai(ai[1]), .bi(bi[2]), .gi(gi[1]), .ti1(ti1[2]), .ti2(w40), .to(w51));
cell3 u_cell3_61 (.ai(ai[1]), .bi(bi[1]), .gi(gi[1]), .ti1(ti1[1]), .ti2(w50), .to(w61));
cell3 u_cell3_71 (.ai(ai[1]), .bi(bi[0]), .gi(gi[1]), .ti1(ti1[0]), .ti2(w60), .to(w71));

cell4 u_cell4_02 (.ai(ai[2]), .bi(bi[7]), .gi(gi[2]), .ti1(ti1[7]), .ti2(ti2[2]), .ti3(ti3[2]), .to(w02));
cell3 u_cell3_12 (.ai(ai[2]), .bi(bi[6]), .gi(gi[2]), .ti1(ti1[6]), .ti2(w01), .to(w12));              
cell3 u_cell3_22 (.ai(ai[2]), .bi(bi[5]), .gi(gi[2]), .ti1(ti1[5]), .ti2(w11), .to(w22));              
cell3 u_cell3_32 (.ai(ai[2]), .bi(bi[4]), .gi(gi[2]), .ti1(ti1[4]), .ti2(w21), .to(w32));              
cell3 u_cell3_42 (.ai(ai[2]), .bi(bi[3]), .gi(gi[2]), .ti1(ti1[3]), .ti2(w31), .to(w42));              
cell3 u_cell3_52 (.ai(ai[2]), .bi(bi[2]), .gi(gi[2]), .ti1(ti1[2]), .ti2(w41), .to(w52));              
cell3 u_cell3_62 (.ai(ai[2]), .bi(bi[1]), .gi(gi[2]), .ti1(ti1[1]), .ti2(w51), .to(w62));              
cell3 u_cell3_72 (.ai(ai[2]), .bi(bi[0]), .gi(gi[2]), .ti1(ti1[0]), .ti2(w61), .to(w72));              

cell4 u_cell4_03 (.ai(ai[3]), .bi(bi[7]), .gi(gi[3]), .ti1(ti1[7]), .ti2(ti2[3]), .ti3(ti3[3]), .to(w03)); 
cell3 u_cell3_13 (.ai(ai[3]), .bi(bi[6]), .gi(gi[3]), .ti1(ti1[6]), .ti2(w02), .to(w13));               
cell3 u_cell3_23 (.ai(ai[3]), .bi(bi[5]), .gi(gi[3]), .ti1(ti1[5]), .ti2(w12), .to(w23));               
cell3 u_cell3_33 (.ai(ai[3]), .bi(bi[4]), .gi(gi[3]), .ti1(ti1[4]), .ti2(w22), .to(w33));               
cell3 u_cell3_43 (.ai(ai[3]), .bi(bi[3]), .gi(gi[3]), .ti1(ti1[3]), .ti2(w32), .to(w43));               
cell3 u_cell3_53 (.ai(ai[3]), .bi(bi[2]), .gi(gi[3]), .ti1(ti1[2]), .ti2(w42), .to(w53));               
cell3 u_cell3_63 (.ai(ai[3]), .bi(bi[1]), .gi(gi[3]), .ti1(ti1[1]), .ti2(w52), .to(w63));               
cell3 u_cell3_73 (.ai(ai[3]), .bi(bi[0]), .gi(gi[3]), .ti1(ti1[0]), .ti2(w62), .to(w73));               

cell4 u_cell4_04 (.ai(ai[4]), .bi(bi[7]), .gi(gi[4]), .ti1(ti1[7]), .ti2(ti2[4]), .ti3(ti3[4]), .to(w04)); 
cell3 u_cell3_14 (.ai(ai[4]), .bi(bi[6]), .gi(gi[4]), .ti1(ti1[6]), .ti2(w03), .to(w14));               
cell3 u_cell3_24 (.ai(ai[4]), .bi(bi[5]), .gi(gi[4]), .ti1(ti1[5]), .ti2(w13), .to(w24));               
cell3 u_cell3_34 (.ai(ai[4]), .bi(bi[4]), .gi(gi[4]), .ti1(ti1[4]), .ti2(w23), .to(w34));               
cell3 u_cell3_44 (.ai(ai[4]), .bi(bi[3]), .gi(gi[4]), .ti1(ti1[3]), .ti2(w33), .to(w44));               
cell3 u_cell3_54 (.ai(ai[4]), .bi(bi[2]), .gi(gi[4]), .ti1(ti1[2]), .ti2(w43), .to(w54));               
cell3 u_cell3_64 (.ai(ai[4]), .bi(bi[1]), .gi(gi[4]), .ti1(ti1[1]), .ti2(w53), .to(w64));               
cell3 u_cell3_74 (.ai(ai[4]), .bi(bi[0]), .gi(gi[4]), .ti1(ti1[0]), .ti2(w63), .to(w74));               

cell4 u_cell4_05 (.ai(ai[5]), .bi(bi[7]), .gi(gi[5]), .ti1(ti1[7]), .ti2(ti2[5]), .ti3(ti3[5]), .to(w05)); 
cell3 u_cell3_15 (.ai(ai[5]), .bi(bi[6]), .gi(gi[5]), .ti1(ti1[6]), .ti2(w04), .to(w15));               
cell3 u_cell3_25 (.ai(ai[5]), .bi(bi[5]), .gi(gi[5]), .ti1(ti1[5]), .ti2(w14), .to(w25));               
cell3 u_cell3_35 (.ai(ai[5]), .bi(bi[4]), .gi(gi[5]), .ti1(ti1[4]), .ti2(w24), .to(w35));               
cell3 u_cell3_45 (.ai(ai[5]), .bi(bi[3]), .gi(gi[5]), .ti1(ti1[3]), .ti2(w34), .to(w45));               
cell3 u_cell3_55 (.ai(ai[5]), .bi(bi[2]), .gi(gi[5]), .ti1(ti1[2]), .ti2(w44), .to(w55));               
cell3 u_cell3_65 (.ai(ai[5]), .bi(bi[1]), .gi(gi[5]), .ti1(ti1[1]), .ti2(w54), .to(w65));               
cell3 u_cell3_75 (.ai(ai[5]), .bi(bi[0]), .gi(gi[5]), .ti1(ti1[0]), .ti2(w64), .to(w75));               
                                                                         
cell4 u_cell4_06 (.ai(ai[6]), .bi(bi[7]), .gi(gi[6]), .ti1(ti1[7]), .ti2(ti2[6]), .ti3(ti3[6]), .to(w06)); 
cell3 u_cell3_16 (.ai(ai[6]), .bi(bi[6]), .gi(gi[6]), .ti1(ti1[6]), .ti2(w05), .to(w16));               
cell3 u_cell3_26 (.ai(ai[6]), .bi(bi[5]), .gi(gi[6]), .ti1(ti1[5]), .ti2(w15), .to(w26));               
cell3 u_cell3_36 (.ai(ai[6]), .bi(bi[4]), .gi(gi[6]), .ti1(ti1[4]), .ti2(w25), .to(w36));               
cell3 u_cell3_46 (.ai(ai[6]), .bi(bi[3]), .gi(gi[6]), .ti1(ti1[3]), .ti2(w35), .to(w46));               
cell3 u_cell3_56 (.ai(ai[6]), .bi(bi[2]), .gi(gi[6]), .ti1(ti1[2]), .ti2(w45), .to(w56));               
cell3 u_cell3_66 (.ai(ai[6]), .bi(bi[1]), .gi(gi[6]), .ti1(ti1[1]), .ti2(w55), .to(w66));               
cell3 u_cell3_76 (.ai(ai[6]), .bi(bi[0]), .gi(gi[6]), .ti1(ti1[0]), .ti2(w65), .to(w76));               

cell4 u_cell4_07 (.ai(ai[7]), .bi(bi[7]), .gi(gi[7]), .ti1(ti1[7]), .ti2(ti2[7]), .ti3(ti3[7]), .to(w07)); 
cell3 u_cell3_17 (.ai(ai[7]), .bi(bi[6]), .gi(gi[7]), .ti1(ti1[6]), .ti2(w06), .to(w17));               
cell3 u_cell3_27 (.ai(ai[7]), .bi(bi[5]), .gi(gi[7]), .ti1(ti1[5]), .ti2(w16), .to(w27));               
cell3 u_cell3_37 (.ai(ai[7]), .bi(bi[4]), .gi(gi[7]), .ti1(ti1[4]), .ti2(w26), .to(w37));               
cell3 u_cell3_47 (.ai(ai[7]), .bi(bi[3]), .gi(gi[7]), .ti1(ti1[3]), .ti2(w36), .to(w47));               
cell3 u_cell3_57 (.ai(ai[7]), .bi(bi[2]), .gi(gi[7]), .ti1(ti1[2]), .ti2(w46), .to(w57));               
cell3 u_cell3_67 (.ai(ai[7]), .bi(bi[1]), .gi(gi[7]), .ti1(ti1[1]), .ti2(w56), .to(w67));               
cell3 u_cell3_77 (.ai(ai[7]), .bi(bi[0]), .gi(gi[7]), .ti1(ti1[0]), .ti2(w66), .to(w77));               

assign to1[0] = w77;
assign to1[1] = w67;
assign to1[2] = w57;
assign to1[3] = w47;
assign to1[4] = w37;
assign to1[5] = w27;
assign to1[6] = w17;
assign to1[7] = w07;

assign to2[0] = w70;
assign to2[1] = w71;
assign to2[2] = w72;
assign to2[3] = w73;
assign to2[4] = w74;
assign to2[5] = w75;
assign to2[6] = w76;

assign ao = ai;
assign go = gi;

endmodule

//说明:如果需要做成pipeline结构的话需要将cell间传递的wire割断,
//      在割断处插入reg,然后对reg的输入和输出线网进行重新命名。

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -