// Verilog HDL for "PC", "pc" "functional"
module pc (clk,in,ctl,out) ;
input clk ; // Clock
input [3:0] in ; // Input
input [1:0] ctl ; // Control
output [3:0] out ; // Output
reg [3:0] pc_reg ; // Register
assign out = pc_reg ;
always @(posedge clk)
begin
case (ctl)
2'b00 : pc_reg <= pc_reg ;
2'b01 : pc_reg <= in ;
2'b10 : pc_reg <= pc_reg + 4'b0001 ;
2'b11 : pc_reg <= 4'b0000 ;
endcase
end
endmodule