doubling.v 787 Bytes
Newer Older
lwc-tester committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
module doubling (/*AUTOARG*/
   // Outputs
   so,
   // Inputs
   si, dold, dnew
   ) ;
   output [127:0] so;
   input [127:0]  si;
   input [7:0] 	  dold, dnew;

   wire [127:0]   li, lo;
   
   assign li = {si[7:0] ^ dold,
		si[15:8],
		si[23:16],
		si[31:24],
		si[39:32],
		si[47:40],
		si[55:48],
		si[63:56],
		si[71:64],
		si[79:72],
		si[87:80],
		si[95:88],
		si[103:96],
		si[111:104],
		si[119:112],
		si[127:120]
		}; 

   assign lo = {li[126:0], li[127]} ^ {120'h0, li[127], 4'h0, li[127], li[127] , 1'b0};

   assign so = {lo[7:0],
		lo[15:8],
		lo[23:16],
		lo[31:24],
		lo[39:32],
		lo[47:40],
		lo[55:48],
		lo[63:56],
		lo[71:64],
		lo[79:72],
		lo[87:80],
		lo[95:88],
		lo[103:96],
		lo[111:104],
		lo[119:112],
		lo[127:120] ^ dnew
		}; 
   
endmodule // doubling