www.pudn.com > SHA1.zip > control.v, change:2001-01-30,size:9119b


 
module control (clock, reset, 	sel_1, sel_2, sel_3, sel_4, sel, hold_672, hold_15, hold_14, hold_13, hold_12, hold_11, hold_10, hold_9, hold_8, hold_7, hold_6, hold_5, hold_4, hold_3, hold_2, hold_1, hold_0, hold_1_4, hold_1_3, hold_1_2, hold_1_1, hold_1_0); 
 
 
	input clock, reset; 
 
	output sel_1, sel_3, hold_672, hold_15, hold_14; 
	output hold_13, hold_12, hold_11, hold_10, hold_9, hold_8, hold_7, hold_6, hold_5; 
	output hold_4, hold_3, hold_2, hold_1, hold_0, hold_1_4, hold_1_3, hold_1_2, hold_1_1, hold_1_0; 
 
	output [3:0] sel_2; 
	output [1:0] sel_4; 
	output [3:0] sel; 
 
	 
	reg sel_1, sel_3, hold_672, hold_15, hold_14; 
	reg hold_13, hold_12, hold_11, hold_10, hold_9, hold_8, hold_7, hold_6, hold_5; 
	reg hold_4, hold_3, hold_2, hold_1, hold_0, hold_1_4, hold_1_3, hold_1_2, hold_1_1, hold_1_0; 
	reg start; 
 
	reg [3:0] sel_2; 
	reg [1:0] sel_4; 
	reg [3:0] sel; 
	 
	reg [7:0] count; 
	 
	always @(posedge clock) begin 
			if (reset) begin 
					sel_1 = 1'b 0; 
					sel_3 = 1'b 0; 
					hold_672 = 1'b 0; 
					hold_15 = 1'b 0; 
					hold_14 = 1'b 0; 
					hold_13 = 1'b 0; 
					hold_12 = 1'b 0; 
					hold_11 = 1'b 0; 
					hold_10 = 1'b 0; 
					hold_9 = 1'b 0; 
					hold_8 = 1'b 0; 
					hold_7 = 1'b 0; 
					hold_6 = 1'b 0; 
					hold_5 = 1'b 0; 
					hold_4 = 1'b 0; 
					hold_3 = 1'b 0; 
					hold_2 = 1'b 0; 
					hold_1 = 1'b 0; 
					hold_0 = 1'b 0; 
					hold_1_4 = 1'b 0; 
					hold_1_3 = 1'b 0; 
					hold_1_2 = 1'b 0; 
					hold_1_1 = 1'b 0; 
					hold_1_0 = 1'b 0; 
					sel_2 = 4'b 0; 
					sel_4 = 2'b 0; 
					sel = 4'b 0; 
					 
					count = 8'b 0; 
					start = 1'b 1; 
				end 
 
		else if (start) begin 
				if (count[7:0] == 8'b 01010100) begin 
					hold_672 = 1'b 1; 
				end 
		 
				else if (count[7:0] == 8'b 01010101) begin 
					sel_3   = 1'b 1; 
					 
					hold_15 = 1'b 1; 
					hold_14 = 1'b 1; 
					hold_13 = 1'b 1; 
					hold_12 = 1'b 1; 
					hold_11 = 1'b 1; 
					hold_10 = 1'b 1; 
 					hold_9  = 1'b 1; 
 					hold_8  = 1'b 1; 
 					hold_7  = 1'b 1; 
 					hold_6  = 1'b 1; 
 					hold_5  = 1'b 1; 
 					hold_4  = 1'b 1; 
 					hold_3  = 1'b 1; 
 					hold_2  = 1'b 1; 
 					hold_1  = 1'b 1; 
 					hold_0  = 1'b 1; 
 				end 
						 
				if (count[7:0] >= 8'b 01010110) begin 
					sel_2 = sel_2 + 1; 
				end 
 
				if (count[7:0] == 8'b 01100100) begin 
					sel_1 = 1'b 1; 
					hold_0 = 1'b 0; 
				end 
	 
				if (count[7:0] >= 8'b 01100101) begin 
					sel = sel + 1; 
				end 
				 
				if (count[7:0] == 8'b 01100101) begin 
					hold_1 = 1'b 0; 
					hold_0 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01100110) begin 
					hold_2 = 1'b 0; 
					hold_1 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01100111) begin 
					hold_3 = 1'b 0; 
					hold_2 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01101000) begin 
					hold_4 = 1'b 0; 
					hold_3 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01101001) begin 
					hold_5 = 1'b 0; 
					hold_4 = 1'b 1; 
					sel_4 = 2'b 01; 
				end 
 
 
				if (count[7:0] == 8'b 01101010) begin 
					hold_6 = 1'b 0; 
					hold_5 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01101011) begin 
					hold_7 = 1'b 0; 
					hold_6 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01101100) begin 
					hold_8 = 1'b 0; 
					hold_7 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01101101) begin 
					hold_9 = 1'b 0; 
					hold_8 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01101110) begin 
					hold_10 = 1'b 0; 
					hold_9 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01101111) begin 
					hold_11 = 1'b 0; 
					hold_10 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01110000) begin 
					hold_12 = 1'b 0; 
					hold_11 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01110001) begin 
					hold_13 = 1'b 0; 
					hold_12 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01110010) begin 
					hold_14 = 1'b 0; 
					hold_13 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01110011) begin 
					hold_15 = 1'b 0; 
					hold_14 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01110100) begin 
					hold_0 = 1'b 0; 
					hold_15 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01110101) begin 
					hold_1 = 1'b 0; 
					hold_0 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01110110) begin 
					hold_2 = 1'b 0; 
					hold_1 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01110111) begin 
					hold_3 = 1'b 0; 
					hold_2 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01111000) begin 
					hold_4 = 1'b 0; 
					hold_3 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01111001) begin 
					hold_5 = 1'b 0; 
					hold_4 = 1'b 1; 
					sel_4 = 2'b 01; 
				end 
 
 
				if (count[7:0] == 8'b 01111010) begin 
					hold_6 = 1'b 0; 
					hold_5 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01111011) begin 
					hold_7 = 1'b 0; 
					hold_6 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01111100) begin 
					hold_8 = 1'b 0; 
					hold_7 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01111101) begin 
					hold_9 = 1'b 0; 
					hold_8 = 1'b 1; 
					sel_4 = 2'b 10; 
				end 
 
				if (count[7:0] == 8'b 01111110) begin 
					hold_10 = 1'b 0; 
					hold_9 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 01111111) begin 
					hold_11 = 1'b 0; 
					hold_10 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10000000) begin 
					hold_12 = 1'b 0; 
					hold_11 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10000001) begin 
					hold_13 = 1'b 0; 
					hold_12 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10000010) begin 
					hold_14 = 1'b 0; 
					hold_13 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10000011) begin 
					hold_15 = 1'b 0; 
					hold_14 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10000100) begin 
					hold_0 = 1'b 0; 
					hold_15 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10000101) begin 
					hold_1 = 1'b 0; 
					hold_0 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10000110) begin 
					hold_2 = 1'b 0; 
					hold_1 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10000111) begin 
					hold_3 = 1'b 0; 
					hold_2 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10001000) begin 
					hold_4 = 1'b 0; 
					hold_3 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10001001) begin 
					hold_5 = 1'b 0; 
					hold_4 = 1'b 1; 
				end 
 
 
				if (count[7:0] == 8'b 10001010) begin 
					hold_6 = 1'b 0; 
					hold_5 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10001011) begin 
					hold_7 = 1'b 0; 
					hold_6 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10001100) begin 
					hold_8 = 1'b 0; 
					hold_7 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10001101) begin 
					hold_9 = 1'b 0; 
					hold_8 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10001110) begin 
					hold_10 = 1'b 0; 
					hold_9 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10001111) begin 
					hold_11 = 1'b 0; 
					hold_10 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10010000) begin 
					hold_12 = 1'b 0; 
					hold_11 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10010001) begin 
					hold_13 = 1'b 0; 
					hold_12 = 1'b 1; 
					sel_4 = 2'b 11; 
				end 
 
				if (count[7:0] == 8'b 10010010) begin 
					hold_14 = 1'b 0; 
					hold_13 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10010011) begin 
					hold_15 = 1'b 0; 
					hold_14 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10010100) begin 
					hold_0 = 1'b 0; 
					hold_15 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10010101) begin 
					hold_1 = 1'b 0; 
					hold_0 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10010110) begin 
					hold_2 = 1'b 0; 
					hold_1 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10010111) begin 
					hold_3 = 1'b 0; 
					hold_2 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10011000) begin 
					hold_4 = 1'b 0; 
					hold_3 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10011001) begin 
					hold_5 = 1'b 0; 
					hold_4 = 1'b 1; 
				end 
 
 
				if (count[7:0] == 8'b 10011010) begin 
					hold_6 = 1'b 0; 
					hold_5 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10011011) begin 
					hold_7 = 1'b 0; 
					hold_6 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10011100) begin 
					hold_8 = 1'b 0; 
					hold_7 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10011101) begin 
					hold_9 = 1'b 0; 
					hold_8 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10011110) begin 
					hold_10 = 1'b 0; 
					hold_9 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10011111) begin 
					hold_11 = 1'b 0; 
					hold_10 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10100000) begin 
					hold_12 = 1'b 0; 
					hold_11 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10100001) begin 
					hold_13 = 1'b 0; 
					hold_12 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10100010) begin 
					hold_14 = 1'b 0; 
					hold_13 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10100011) begin 
					hold_15 = 1'b 0; 
					hold_14 = 1'b 1; 
				end 
 
				if (count[7:0] == 8'b 10100100) begin 
					hold_15 = 1'b 1; 
				end 
		 
				if (count[7:0] == 8'b 10100101) begin 
					hold_1_4 = 1'b 1;	 
					hold_1_3 = 1'b 1;	 
					hold_1_2 = 1'b 1;	 
					hold_1_1 = 1'b 1;	 
					hold_1_0 = 1'b 1;	 
				end 
				  
 
		end 
 
	count = count + 1; 
	 
	end 
endmodule