gateware

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit ebfafb004791c2ed75d458daff6a92eb2f05ce49
parent 9c107de586e66b05777bda0cffcd848eeef6762d
Author: Brian Swetland <swetland@frotz.net>
Date:   Wed, 30 Dec 2015 20:03:23 -0800

add reset to cpu

Diffstat:
Mhdl/cpu/cpu.v | 15+++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/hdl/cpu/cpu.v b/hdl/cpu/cpu.v @@ -18,7 +18,8 @@ module cpu #( output [15:0]mem_waddr_o, output [15:0]mem_wdata_o, output mem_wr_o, - output mem_rd_o + output mem_rd_o, + input reset ); localparam AWIDTH = 16; @@ -139,9 +140,15 @@ always @(*) begin end always @(posedge clk) begin - pc <= do_load_pc ? pc_next : pc; - ir_valid <= ir_valid_next; - ir_loading <= ir_loading_next; + if (reset) begin + pc <= 16'd0; + ir_valid <= 1'd0; + ir_loading <= 1'd0; + end else begin + pc <= do_load_pc ? pc_next : pc; + ir_valid <= ir_valid_next; + ir_loading <= ir_loading_next; + end ir <= ir_next; end