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

Subversion Repositories quark

[/] [quark/] [trunk/] [05_HDLConstruction/] [01_OldArchitecture_ReferenceOnly/] [ProgramCounter/] [ProgramCounter.v] - Rev 3

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

module ProgramCounter(
  input        Clock,
  input        Reset,
  input        IncrementPC,
  input        WritePC,
  input  [0:7] NewPC,
  output [0:7] ProgramCounter
  );
 
  reg [0:7] TemporalPC;
 
  always@(posedge Clock, negedge Reset) begin
    if (Reset == 1'b0) begin
      TemporalPC <= 8'h00;
    end else begin
      case (WritePC)
        1'b0: begin
          if (TemporalPC < 8'hFF) begin
            TemporalPC <= TemporalPC + IncrementPC;
          end else begin
            TemporalPC <= 8'h00;
          end
        end
        1'b1: begin
          TemporalPC <= NewPC;
        end
      endcase
    end
  end
 
  assign ProgramCounter = TemporalPC;
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.