URL
https://opencores.org/ocsvn/instruction_list_pipelined_processor_with_peripherals/instruction_list_pipelined_processor_with_peripherals/trunk
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 8 |
Rev 9 |
Line 8... |
Line 8... |
input clk, reset, branch;
|
input clk, reset, branch;
|
input [`instAddrLen-1:0] pcIn;
|
input [`instAddrLen-1:0] pcIn;
|
|
|
output [`instAddrLen-1:0] pcOut;
|
output [`instAddrLen-1:0] pcOut;
|
|
|
reg [`instAddrLen-1:0] pc = `instAddrLen'b0;
|
reg [`instAddrLen-1:0] pcOut = `instAddrLen'b0;
|
|
|
always @ (posedge clk or posedge reset)
|
always @ (posedge clk)
|
begin
|
begin
|
|
|
if (reset)
|
if (reset)
|
begin
|
begin
|
pc = `instAddrLen'b0;
|
pcOut = `instAddrLen'b0;
|
$write ("\nprogram counter module is reset. Starting at address 00h ");
|
$write ("\nprogram counter module is reset. Starting at address 00h ");
|
end
|
end
|
|
|
else
|
else
|
begin
|
begin
|
|
|
if(branch)
|
if(branch)
|
begin
|
begin
|
pc = pcIn;
|
pcOut = pcIn;
|
$write ("\nbranching at address %h", pcIn);
|
$write ("\nbranching at address %h", pcIn);
|
end
|
end
|
else
|
else
|
begin
|
begin
|
pc = pc + 1'b1;
|
pcOut = pcOut + 1'b1;
|
end
|
end
|
end
|
end
|
end // end always
|
end // end always
|
|
|
|
|
assign pcOut = pc;
|
|
|
|
|
|
endmodule
|
endmodule
|
|
|
No newline at end of file
|
No newline at end of file
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.