data/full_repos/permissive/492213907/codes/Datapath_Unit.v
data/verilator_xmls/c2b85d60-e683-436e-97fa-f14dea8944e7.xml
module Datapath_Unit(Led, mode, clk, en, rst, LR, switch_r1r2, auto_rst);

	input [1:0] mode;
	input	clk, en, rst, LR, switch_r1r2, auto_rst;
	output reg [26:0] Led;
	
	always @(posedge clk) begin
	
	
		if (mode == 2'b01) begin
			
			if (rst == 1)
				Led <= 27'h07;
				
			else if (en == 1) begin
			
				if (LR == 0)
					Led <= {Led[23:0], 3'b0};
				else
					Led <= {3'b0, Led[26:3]};
			
			end
			
		end
		
		
		else if (mode == 2'b10) begin
			
			if (rst == 1)
				Led <= 27'b100000000000000000000000001;


			
			else if (en == 1) begin
			
				if (LR == 0) begin
					Led[12:0] <= {Led[11:0], 1'b1};
					Led[26:13] <= {1'b1, Led[26:14]};
				end
				
				else
					Led <= {1'b0, Led[26:1]};
			
			end
			
		end
		
		
		else if (mode == 2'b11) begin
			
			if (rst == 1)
				Led <= 27'h07;
			
			else if (auto_rst == 1) begin
				if (LR == 0)
					Led <= 27'b100000000000000000000000001; 
				else if (LR == 1)
					Led[2:0] <= 3'b111;
			end
			
			else if (en == 1) begin
			
				if (LR == 0 && switch_r1r2 == 0)
					Led <= {Led[23:0], 3'b0};
					
				else if (LR == 1 && switch_r1r2 == 0)
					Led <= {3'b0, Led[26:3]};

				else if (LR == 0 && switch_r1r2 == 1) begin
					Led[12:0] <= {Led[11:0], 1'b1};
					Led[26:13] <= {1'b1, Led[26:14]};
				end
				
				else if (LR == 1 && switch_r1r2 == 1)
					Led <= {1'b0, Led[26:1]};
			
			end
		
		end
		
		
		else
			Led = 27'h0;
			
		
	end
	
endmodule
module Datapath_Unit(Led, mode, clk, en, rst, LR, switch_r1r2, auto_rst);


	input [1:0] mode;
	input	clk, en, rst, LR, switch_r1r2, auto_rst;
	output reg [26:0] Led;
	
	always @(posedge clk) begin
	
	
		if (mode == 2'b01) begin
			
			if (rst == 1)
				Led <= 27'h07;
				
			else if (en == 1) begin
			
				if (LR == 0)
					Led <= {Led[23:0], 3'b0};
				else
					Led <= {3'b0, Led[26:3]};
			
			end
			
		end
		
		
		else if (mode == 2'b10) begin
			
			if (rst == 1)
				Led <= 27'b100000000000000000000000001;


			
			else if (en == 1) begin
			
				if (LR == 0) begin
					Led[12:0] <= {Led[11:0], 1'b1};
					Led[26:13] <= {1'b1, Led[26:14]};
				end
				
				else
					Led <= {1'b0, Led[26:1]};
			
			end
			
		end
		
		
		else if (mode == 2'b11) begin
			
			if (rst == 1)
				Led <= 27'h07;
			
			else if (auto_rst == 1) begin
				if (LR == 0)
					Led <= 27'b100000000000000000000000001; 
				else if (LR == 1)
					Led[2:0] <= 3'b111;
			end
			
			else if (en == 1) begin
			
				if (LR == 0 && switch_r1r2 == 0)
					Led <= {Led[23:0], 3'b0};
					
				else if (LR == 1 && switch_r1r2 == 0)
					Led <= {3'b0, Led[26:3]};

				else if (LR == 0 && switch_r1r2 == 1) begin
					Led[12:0] <= {Led[11:0], 1'b1};
					Led[26:13] <= {1'b1, Led[26:14]};
				end
				
				else if (LR == 1 && switch_r1r2 == 1)
					Led <= {1'b0, Led[26:1]};
			
			end
		
		end
		
		
		else
			Led = 27'h0;
			
		
	end
	
endmodule