OpenCores
URL https://opencores.org/ocsvn/instruction_list_pipelined_processor_with_peripherals/instruction_list_pipelined_processor_with_peripherals/trunk

Subversion Repositories instruction_list_pipelined_processor_with_peripherals

[/] [instruction_list_pipelined_processor_with_peripherals/] [trunk/] [hdl/] [pgmCounter.v] - Rev 9

Go to most recent revision | Compare with Previous | Blame | View Log

 
`include "timescale.v"
`include "defines.v"
 
 
module pgmCounter (clk, reset, branch, pcIn, pcOut);
 
	input clk, reset, branch;
	input [`instAddrLen-1:0] pcIn;
 
	output [`instAddrLen-1:0] pcOut;
 
	reg [`instAddrLen-1:0] pcOut = `instAddrLen'b0;
 
	always @ (posedge clk)
	begin
 
		if (reset)
		begin
			pcOut = `instAddrLen'b0;
			$write ("\nprogram counter module is reset. Starting at address 00h	");
		end
 
		else
		begin
 
			if(branch)
			begin
				pcOut = pcIn;
				$write ("\nbranching at address %h", pcIn);
			end
			else
			begin
				pcOut = pcOut + 1'b1;
			end
		end
	end	// end always
 
 
endmodule
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.