data/full_repos/permissive/444454417/UART_TX.v
1: b'%Warning-LITENDIAN: data/full_repos/permissive/444454417/UART_TX.v:7: Little bit endian vector: MSB < LSB of bit range: 0:31\n reg [0:31] ctr_led;  \n     ^\n                    ... Use "/* verilator lint_off LITENDIAN */" and lint_on around source to disable this message.\n%Warning-LITENDIAN: data/full_repos/permissive/444454417/UART_TX.v:8: Little bit endian vector: MSB < LSB of bit range: 0:31\n reg [0:31] ctr_tx;  \n     ^\n%Warning-LITENDIAN: data/full_repos/permissive/444454417/UART_TX.v:12: Little bit endian vector: MSB < LSB of bit range: 0:7\n reg [0:7] tmp;\n     ^\n%Warning-LITENDIAN: data/full_repos/permissive/444454417/UART_TX.v:13: Little bit endian vector: MSB < LSB of bit range: 0:63\n reg [0:63] s;  \n     ^\n%Warning-LITENDIAN: data/full_repos/permissive/444454417/UART_TX.v:15: Little bit endian vector: MSB < LSB of bit range: 0:9\n reg [0:9] next;  \n     ^\n%Warning-LITENDIAN: data/full_repos/permissive/444454417/UART_TX.v:19: Little bit endian vector: MSB < LSB of bit range: 0:3\n reg [0:3] buttonDisabled;  \n     ^\n%Error: Exiting due to 6 warning(s)\n'
module UART_TX (
		input clk, x0, x1, x2, x3,
		output l0, l1, l2, l3, tx
	); 
	
	reg [0:0] tx_data;
	reg [0:31] ctr_led;
	reg [0:31] ctr_tx;
	reg [0:0] b = 0;

	integer i = 0;
	reg [0:7] tmp;
	reg [0:63] s;
	integer strLen = 0;
	reg [0:9] next;
	reg [0:0] getNext = 0;
	integer idx = 0;
	
	reg [0:3] buttonDisabled;
	
	assign {l0} = {b};
	assign {l1, l2, l3} = {x1, x2, x3};
	assign tx = tx_data;
	
	always @ (posedge clk) begin
				
		ctr_led = ctr_led + 1;
		if(ctr_led == 50000000) begin
			ctr_led = 0;
			b = !b;
		end
		
		ctr_tx = ctr_tx +1;
		if(ctr_tx == 5208) begin
			ctr_tx = 0;					
		
			if(strLen > 0) begin
										
				if(getNext == 1) begin
					getNext = 0;
					next[0] = 1'b0;
					tmp = s[0:7];
					for (i=0; i<8; i=i+1) next[1+i] = tmp[7-i];
					
					next[9] = 1'b1;
					
					s = s << 8;
				end
				
				tx_data = next[idx];
				
				if (idx == 9) begin					
					if(strLen > 0) begin
						idx = 0; 
						getNext = 1;
						strLen = strLen - 1;
					end					
				end				
				else begin
					idx = idx + 1;
				end
			end		
			
		end
		
		if(x0 == 0 && buttonDisabled[0] == 0) begin
			if(strLen == 0) begin
				buttonDisabled[0] = 1;
				s = "sean\r\n";
				getNext = 1;				
				strLen = 8;
			end
		end
		if(x0 == 1) begin
			buttonDisabled[0] = 0;
		end
				
		if(x1 == 0 && buttonDisabled[1] == 0) begin
			if(strLen == 0) begin
				buttonDisabled[1] = 1;
				s = "was \r\n";
				getNext = 1;				
				strLen = 8;
			end			
		end
		if(x1 == 1) begin
			buttonDisabled[1] = 0;
		end
		
		if(x2 == 0) begin
			if(strLen == 0) begin
				s = "ere \r\n";
				getNext = 1;				
				strLen = 8;
			end			
		end
		
		if(x3 == 0) begin
			if(strLen == 0) begin
				s = "#12345\n";
				getNext = 1;				
				strLen = 8;
			end			
		end
	end
	
endmodule
module UART_TX (
		input clk, x0, x1, x2, x3,
		output l0, l1, l2, l3, tx
	);
 
	
	reg [0:0] tx_data;
	reg [0:31] ctr_led;
	reg [0:31] ctr_tx;
	reg [0:0] b = 0;

	integer i = 0;
	reg [0:7] tmp;
	reg [0:63] s;
	integer strLen = 0;
	reg [0:9] next;
	reg [0:0] getNext = 0;
	integer idx = 0;
	
	reg [0:3] buttonDisabled;
	
	assign {l0} = {b};
	assign {l1, l2, l3} = {x1, x2, x3};
	assign tx = tx_data;
	
	always @ (posedge clk) begin
				
		ctr_led = ctr_led + 1;
		if(ctr_led == 50000000) begin
			ctr_led = 0;
			b = !b;
		end
		
		ctr_tx = ctr_tx +1;
		if(ctr_tx == 5208) begin
			ctr_tx = 0;					
		
			if(strLen > 0) begin
										
				if(getNext == 1) begin
					getNext = 0;
					next[0] = 1'b0;
					tmp = s[0:7];
					for (i=0; i<8; i=i+1) next[1+i] = tmp[7-i];
					
					next[9] = 1'b1;
					
					s = s << 8;
				end
				
				tx_data = next[idx];
				
				if (idx == 9) begin					
					if(strLen > 0) begin
						idx = 0; 
						getNext = 1;
						strLen = strLen - 1;
					end					
				end				
				else begin
					idx = idx + 1;
				end
			end		
			
		end
		
		if(x0 == 0 && buttonDisabled[0] == 0) begin
			if(strLen == 0) begin
				buttonDisabled[0] = 1;
				s = "sean\r\n";
				getNext = 1;				
				strLen = 8;
			end
		end
		if(x0 == 1) begin
			buttonDisabled[0] = 0;
		end
				
		if(x1 == 0 && buttonDisabled[1] == 0) begin
			if(strLen == 0) begin
				buttonDisabled[1] = 1;
				s = "was \r\n";
				getNext = 1;				
				strLen = 8;
			end			
		end
		if(x1 == 1) begin
			buttonDisabled[1] = 0;
		end
		
		if(x2 == 0) begin
			if(strLen == 0) begin
				s = "ere \r\n";
				getNext = 1;				
				strLen = 8;
			end			
		end
		
		if(x3 == 0) begin
			if(strLen == 0) begin
				s = "#12345\n";
				getNext = 1;				
				strLen = 8;
			end			
		end
	end
	
endmodule