URL
https://opencores.org/ocsvn/zipcpu/zipcpu/trunk
Subversion Repositories zipcpu
Compare Revisions
- This comparison shows the changes necessary to convert path
/zipcpu
- from Rev 38 to Rev 37
- ↔ Reverse comparison
Rev 38 → Rev 37
/trunk/rtl/zipbones.v
File deleted
/trunk/rtl/core/pipemem.v
File deleted
/trunk/rtl/core/pipefetch.v
215,13 → 215,7
always @(posedge i_clk) |
if (i_clear_cache) |
o_wb_addr <= i_pc; |
else if ((o_wb_cyc)&&(w_pc_out_of_bounds)) |
begin |
if (i_wb_ack) |
o_wb_addr <= r_cache_base + bus_nvalid+1; |
else |
o_wb_addr <= r_cache_base + bus_nvalid; |
end else if ((~o_wb_cyc)&&((w_pc_out_of_bounds) |
else if ((~o_wb_cyc)&&((w_pc_out_of_bounds) |
||(w_ran_off_end_of_cache))) |
o_wb_addr <= (i_new_pc) ? i_pc : r_addr; |
else if ((o_wb_cyc)&&(o_wb_stb)&&(~i_wb_stall)) |
231,9 → 225,9
always @(posedge i_clk) |
if (~o_wb_cyc) |
r_acks_waiting <= 0; |
else if ((o_wb_cyc)&&(o_wb_stb)&&(~i_wb_stall)&&(~i_wb_ack)) |
else if ((o_wb_stb)&&(~i_wb_stall)&&(~i_wb_ack)) |
r_acks_waiting <= r_acks_waiting + 1; |
else if ((o_wb_cyc)&&(i_wb_ack)&&((~o_wb_stb)||(i_wb_stall))) |
else if ((i_wb_ack)&&((~o_wb_stb)||(i_wb_stall))) |
r_acks_waiting <= r_acks_waiting - 1; |
|
always @(posedge i_clk) |
/trunk/rtl/core/zipcpu.v
116,7 → 116,7
// Single Fetching 2521 1734 |
// Pipelined fetching 2796 2046 |
// |
// `define OPT_SINGLE_FETCH |
// `define SINGLE_FETCH |
// |
// |
// |
128,14 → 128,12
`define CPU_GIE_BIT 5 |
`define CPU_SLEEP_BIT 4 |
// Compile time defines |
// (Currently unused) |
// `define OPT_SINGLE_FETCH |
// (Best path--define these!) |
`define OPT_CONDITIONAL_FLAGS |
`define OPT_PRECLEAR_BUS |
`define OPT_ILLEGAL_INSTRUCTION |
`define OPT_EARLY_BRANCHING |
`define OPT_PIPELINED_BUS_ACCESS |
// `define SINGLE_FETCH |
`define NG_CONDITIONAL_FLAGS |
`define NG_PRECLEAR_BUS // 0.61 w/ or w/o |
// `define NG_BRANCH_DELAY_SLOT |
`define NG_ILLEGAL_INSTRUCTION |
`define NG_EARLY_BRANCHING // 0.60 w/, 0.61 w/o ???? |
module zipcpu(i_clk, i_rst, i_interrupt, |
// Debug interface |
i_halt, i_clear_pf_cache, i_dbg_reg, i_dbg_we, i_dbg_data, |
149,7 → 147,7
i_wb_err, |
// Accounting/CPU usage interface |
o_op_stall, o_pf_stall, o_i_count); |
parameter RESET_ADDRESS=32'h0100000, LGICACHE=9; |
parameter RESET_ADDRESS=32'h0100000; |
input i_clk, i_rst, i_interrupt; |
// Debug interface -- inputs |
input i_halt, i_clear_pf_cache; |
182,10 → 180,8
reg [3:0] flags, iflags; // (TRAP,FPEN,BREAKEN,STEP,GIE,SLEEP ), V, N, C, Z |
wire [10:0] w_uflags, w_iflags; |
reg trap, break_en, step, gie, sleep; |
`ifdef OPT_ILLEGAL_INSTRUCTION |
`ifdef NG_ILLEGAL_INSTRUCTION |
reg ill_err; |
`else |
wire ill_err; |
`endif |
reg bus_err_flag; |
|
226,13 → 222,13
reg [23:0] r_dcdI; |
wire dcdA_stall, dcdB_stall, dcdF_stall; |
|
`ifdef OPT_PRECLEAR_BUS |
`ifdef NG_PRECLEAR_BUS |
reg dcd_clear_bus; |
`endif |
`ifdef OPT_ILLEGAL_INSTRUCTION |
`ifdef NG_ILLEGAL_INSTRUCTION |
reg dcd_illegal; |
`endif |
`ifdef OPT_EARLY_BRANCHING |
`ifdef NG_EARLY_BRANCHING |
reg dcd_early_branch_stb, dcd_early_branch; |
reg [31:0] dcd_branch_pc; |
`else |
261,10 → 257,10
reg [6:0] r_opF; |
wire [8:0] opF; |
wire op_ce; |
`ifdef OPT_PRECLEAR_BUS |
`ifdef NG_PRECLEAR_BUS |
reg op_clear_bus; |
`endif |
`ifdef OPT_ILLEGAL_INSTRUCTION |
`ifdef NG_ILLEGAL_INSTRUCTION |
reg op_illegal; |
`endif |
|
283,18 → 279,13
wire alu_valid; |
wire set_cond; |
reg alu_wr, alF_wr, alu_gie; |
`ifdef OPT_ILLEGAL_INSTRUCTION |
`ifdef NG_ILLEGAL_INSTRUCTION |
reg alu_illegal; |
`else |
wire alu_illegal; |
`endif |
|
|
|
wire mem_ce, mem_stalled; |
`ifdef OPT_PIPELINED_BUS_ACCESS |
wire mem_pipe_stalled; |
`endif |
wire mem_valid, mem_ack, mem_stall, mem_err, bus_err, |
mem_cyc_gbl, mem_cyc_lcl, mem_stb_gbl, mem_stb_lcl, mem_we; |
wire [4:0] mem_wreg; |
320,7 → 311,7
// |
// MASTER: clock enable. |
// |
assign master_ce = (~i_halt)&&(~o_break)&&(~sleep); |
assign master_ce = (~i_halt)&&(~o_break)&&(~sleep)&&(~mem_rdbusy); |
|
|
// |
334,7 → 325,9
assign dcd_stalled = (dcdvalid)&&( |
(op_stall) |
||((dcdA_stall)||(dcdB_stall)||(dcdF_stall)) |
`ifndef NG_BRANCH_DELAY_SLOT |
||((opvalid_mem)&&(op_wr_pc)) |
`endif |
||((opvalid_mem)&&(opR_cc))); |
// |
// PIPELINE STAGE #3 :: Read Operands |
357,26 → 350,17
// through the ALU. Break instructions are not allowed through |
// the ALU. |
assign alu_stall = (((~master_ce)||(mem_rdbusy))&&(opvalid_alu)) //Case 1&2 |
`ifdef BEFORE |
||((opvalid)&&(wr_reg_ce)&&(wr_reg_id[4] == op_gie) |
&&((wr_write_pc)||(wr_write_cc)) // Case 3 |
`else |
||((opvalid_mem)&&(wr_reg_ce)&&(wr_reg_id[4] == op_gie) |
&&((wr_write_pc)||(wr_write_cc))) // Case 3 |
`endif |
||((opvalid)&&(op_break)); // Case 4 |
assign alu_ce = (master_ce)&&(~mem_rdbusy)&&(opvalid_alu)&&(~alu_stall)&&(~clear_pipeline); |
assign alu_ce = (master_ce)&&(opvalid_alu)&&(~alu_stall)&&(~clear_pipeline); |
// |
`ifdef OPT_PIPELINED_BUS_ACCESS |
assign mem_ce = (master_ce)&&(opvalid_mem)&&(~clear_pipeline) |
&&(set_cond)&&(~mem_stalled); |
assign mem_stalled = (~master_ce)||((opvalid_mem)&&( |
(mem_pipe_stalled) |
||((~op_pipe)&&(mem_busy)) |
// Stall waiting for flags to be valid |
// Or waiting for a write to the PC register |
// Or CC register, since that can change the |
// PC as well |
||((wr_reg_ce)&&(wr_reg_id[4] == op_gie) |
&&((wr_write_pc)||(wr_write_cc))))); |
`else |
assign mem_ce = (master_ce)&&(opvalid_mem)&&(~mem_stalled)&&(~clear_pipeline)&&(set_cond); |
|
assign mem_stalled = (mem_busy)||((opvalid_mem)&&( |
(~master_ce) |
// Stall waiting for flags to be valid |
384,7 → 368,6
// Or CC register, since that can change the |
// PC as well |
||((wr_reg_ce)&&(wr_reg_id[4] == op_gie)&&((wr_write_pc)||(wr_write_cc))))); |
`endif |
|
|
// |
392,7 → 375,7
// PIPELINE STAGE #1 :: Prefetch |
// |
// |
`ifdef OPT_SINGLE_FETCH |
`ifdef SINGLE_FETCH |
wire pf_ce; |
|
assign pf_ce = (~dcd_stalled); |
402,7 → 385,7
pf_cyc, pf_stb, pf_we, pf_addr, pf_data, |
pf_ack, pf_stall, pf_err, i_wb_data); |
`else // Pipe fetch |
pipefetch #(RESET_ADDRESS, LGICACHE) |
pipefetch #(RESET_ADDRESS) |
pf(i_clk, i_rst, (new_pc)|(dcd_early_branch_stb), |
i_clear_pf_cache, ~dcd_stalled, |
(new_pc)?pf_pc:dcd_branch_pc, |
409,7 → 392,7
instruction, instruction_pc, pf_valid, |
pf_cyc, pf_stb, pf_we, pf_addr, pf_data, |
pf_ack, pf_stall, pf_err, i_wb_data, |
`ifdef OPT_PRECLEAR_BUS |
`ifdef NG_PRECLEAR_BUS |
((dcd_clear_bus)&&(dcdvalid)) |
||((op_clear_bus)&&(opvalid)) |
|| |
428,9 → 411,9
else if ((~dcd_stalled)||(clear_pipeline)||(dcd_early_branch)) |
dcdvalid <= 1'b0; |
|
`ifdef OPT_EARLY_BRANCHING |
`ifdef NG_EARLY_BRANCHING |
always @(posedge i_clk) |
if ((dcd_ce)&&(instruction[27:24]==`CPU_PC_REG)&&(~sleep)) |
if ((dcd_ce)&&(instruction[27:24]==`CPU_PC_REG)) |
begin |
dcd_early_branch <= 1'b0; |
// First case, a move to PC instruction |
473,11 → 456,11
else // if (instruction[28]) // 4'h3 = LDI |
dcd_branch_pc <= instruction_pc+32'h01+{ {(8){instruction[23]}}, instruction[23:0] }; |
end |
`else // OPT_EARLY_BRANCHING |
`else // NG_EARLY_BRANCHING |
assign dcd_early_branch_stb = 1'b0; |
assign dcd_early_branch = 1'b0; |
assign dcd_branch_pc = 32'h00; |
`endif // OPT_EARLY_BRANCHING |
`endif // NG_EARLY_BRANCHING |
|
always @(posedge i_clk) |
if (dcd_ce) |
495,15 → 478,15
dcdA_pc <= (instruction[27:24] == `CPU_PC_REG); |
dcdB_pc <= (instruction[19:16] == `CPU_PC_REG); |
dcdM <= 1'b0; |
`ifdef OPT_CONDITIONAL_FLAGS |
`ifdef NG_CONDITIONAL_FLAGS |
dcdF_wr <= (instruction[23:21]==3'h0); |
`else |
dcdF_wr <= 1'b1; |
`endif |
`ifdef OPT_PRECLEAR_BUS |
`ifdef NG_PRECLEAR_BUS |
dcd_clear_bus <= 1'b0; |
`endif |
`ifdef OPT_ILLEGAL_INSTRUCTION |
`ifdef NG_ILLEGAL_INSTRUCTION |
dcd_illegal <= pf_illegal; |
`endif |
|
534,7 → 517,7
dcdOp <= 4'h2; |
end |
4'h4: begin // Multiply, LDI[HI|LO], or NOOP/BREAK |
`ifdef OPT_CONDITIONAL_FLAGS |
`ifdef NG_CONDITIONAL_FLAGS |
// Don't write flags except for multiplies |
// and then only if they are unconditional |
dcdF_wr <= ((instruction[27:25] != 3'h7) |
553,7 → 536,7
dcdOp <= 4'h2; |
// Might also be a break. Big |
// instruction set hole here. |
`ifdef OPT_ILLEGAL_INSTRUCTION |
`ifdef NG_ILLEGAL_INSTRUCTION |
dcd_illegal <= (pf_illegal)||(instruction[23:1] != 0); |
`endif |
end else if (instruction[27:24] == 4'hf) |
582,7 → 565,7
else |
r_dcdI <= { {(4){instruction[19]}}, instruction[19:0] }; |
dcdM <= 1'b1; // Memory operation |
`ifdef OPT_PRECLEAR_BUS |
`ifdef NG_PRECLEAR_BUS |
dcd_clear_bus <= (instruction[23:21]==3'h0); |
`endif |
end |
603,35 → 586,10
always @(posedge i_clk) |
if (dcd_ce) |
dcd_break <= (instruction[31:0] == 32'h4e000001); |
else if ((clear_pipeline)||(~dcdvalid)) // SHOULDNT THIS BE ||op_ce? |
else if ((clear_pipeline)||(~dcdvalid)) |
dcd_break <= 1'b0; |
|
`ifdef OPT_PIPELINED_BUS_ACCESS |
reg [23:0] r_opI; |
reg [4:0] op_B; |
reg op_pipe; |
|
initial op_pipe = 1'b0; |
// To be a pipeable operation, there must be |
// two valid adjacent instructions |
// Both must be memory instructions |
// Both must be writes, or both must be reads |
// Both operations must be to the same identical address, |
// or at least a single (one) increment above that address |
always @(posedge i_clk) |
if (op_ce) |
op_pipe <= (dcdvalid)&&(opvalid_mem)&&(dcdM) // Both mem |
&&(dcdOp[0]==opn[0]) // Both Rd, or both Wr |
&&(dcdB == op_B) // Same address register |
&&((r_dcdI == r_opI)||(r_dcdI==r_opI+24'h1)); |
always @(posedge i_clk) |
if (op_ce) // &&(dcdvalid)) |
r_opI <= r_dcdI; |
always @(posedge i_clk) |
if (op_ce) // &&(dcdvalid)) |
op_B <= dcdB; |
`endif |
|
// |
// |
// PIPELINE STAGE #3 :: Read Operands (Registers) |
710,7 → 668,7
// wait until our operands are valid, then we aren't |
// valid yet until then. |
opvalid<= (~clear_pipeline)&&(dcdvalid)&&(~dcd_stalled); |
`ifdef OPT_ILLEGAL_INSTRUCTION |
`ifdef NG_ILLEGAL_INSTRUCTION |
opvalid_mem <= (dcdM)&&(~dcd_illegal)&&(~clear_pipeline)&&(dcdvalid)&&(~dcd_stalled); |
opvalid_alu <= ((~dcdM)||(dcd_illegal))&&(~clear_pipeline)&&(dcdvalid)&&(~dcd_stalled); |
`else |
740,7 → 698,7
else if ((clear_pipeline)||(~opvalid)) |
op_break <= 1'b0; |
|
`ifdef OPT_ILLEGAL_INSTRUCTION |
`ifdef NG_ILLEGAL_INSTRUCTION |
always @(posedge i_clk) |
if(op_ce) |
op_illegal <= dcd_illegal; |
751,7 → 709,7
begin |
opn <= dcdOp; // Which ALU operation? |
// opM <= dcdM; // Is this a memory operation? |
`ifdef OPT_EARLY_BRANCHING |
`ifdef NG_EARLY_BRANCH |
opF_wr <= (dcdF_wr)&&((~dcdA_cc)||(~dcdA_wr))&&(~dcd_early_branch); |
opR_wr <= (dcdA_wr)&&(~dcd_early_branch); |
`else |
762,7 → 720,7
`endif |
// What register will these results be written into? |
opR <= dcdA; |
opR_cc <= (dcdA_wr)&&(dcdA_cc)&&(dcdA[4]==dcd_gie); |
opR_cc <= (dcdA_wr)&&(dcdA_cc); |
// User level (1), vs supervisor (0)/interrupts disabled |
op_gie <= dcd_gie; |
|
775,13 → 733,13
opB_rd <= dcdB_rd; |
op_pc <= dcd_pc; |
// |
`ifdef OPT_EARLY_BRANCHING |
`ifdef NG_EARLY_BRANCHING |
op_wr_pc <= ((dcdA_wr)&&(dcdA_pc)&&(dcdA[4] == dcd_gie))&&(~dcd_early_branch); |
`else |
op_wr_pc <= ((dcdA_wr)&&(dcdA_pc)&&(dcdA[4] == dcd_gie)); |
`endif |
|
`ifdef OPT_PRECLEAR_BUS |
`ifdef NG_PRECLEAR_BUS |
op_clear_bus <= dcd_clear_bus; |
`endif |
end |
819,24 → 777,9
opB_alu <= (opvalid_alu)&&(opR == dcdB)&&(dcdB_rd)&&(dcdI == 0); |
assign opB = (opB_alu) ? alu_result : r_opB; |
assign dcdB_stall = (dcdvalid)&&(dcdB_rd)&&( |
// Stall on memory ops writing to my register |
// (i.e. loads), or on any write to my |
// register if I have an immediate offset |
// Note the exception for writing to the PC: |
// if I write to the PC, the whole next |
// instruction is invalid, not just the |
// operand. That'll get wiped in the |
// next operation anyway, so don't stall |
// here. |
((opvalid)&&(opR_wr)&&(opR == dcdB) |
&&(opR != { op_gie, `CPU_PC_REG} ) |
&&((opvalid_mem)||(dcdI != 0))) |
// Stall on any write to the flags register, |
// if we're going to need the flags value for |
// opB. |
||((opvalid_alu)&&(opF_wr)&&(dcdB_cc)) |
// Stall on any ongoing memory operation that |
// will write to opB |
||((mem_busy)&&(~mem_we)&&(mem_wreg == dcdB))); |
assign dcdF_stall = (dcdvalid)&&((~dcdF[3])||(dcdA_cc)||(dcdB_cc)) |
&&(opvalid)&&(opR_cc); |
874,37 → 817,18
always @(posedge i_clk) |
if ((alu_ce)||(mem_ce)) |
alu_pc <= op_pc; |
`ifdef OPT_ILLEGAL_INSTRUCTION |
always @(posedge i_clk) |
if ((alu_ce)||(mem_ce)) |
alu_illegal <= op_illegal; |
`endif |
|
initial alu_pc_valid = 1'b0; |
always @(posedge i_clk) |
alu_pc_valid <= (~i_rst)&&(master_ce)&&(~mem_rdbusy)&&(opvalid)&&(~clear_pipeline) |
alu_pc_valid <= (~i_rst)&&(master_ce)&&(opvalid)&&(~clear_pipeline) |
&&((opvalid_alu)||(~mem_stalled)); |
|
`ifdef OPT_PIPELINED_BUS_ACCESS |
pipemem domem(i_clk, i_rst, mem_ce, |
(opn[0]), opB, opA, opR, |
mem_busy, mem_pipe_stalled, |
mem_valid, bus_err, mem_wreg, mem_result, |
mem_cyc_gbl, mem_cyc_lcl, |
mem_stb_gbl, mem_stb_lcl, |
mem_we, mem_addr, mem_data, |
mem_ack, mem_stall, mem_err, i_wb_data); |
|
`else // PIPELINED_BUS_ACCESS |
memops domem(i_clk, i_rst, mem_ce, |
(opn[0]), opB, opA, opR, |
mem_busy, |
mem_valid, bus_err, mem_wreg, mem_result, |
mem_busy, mem_valid, bus_err, mem_wreg, mem_result, |
mem_cyc_gbl, mem_cyc_lcl, |
mem_stb_gbl, mem_stb_lcl, |
mem_we, mem_addr, mem_data, |
mem_ack, mem_stall, mem_err, i_wb_data); |
`endif // PIPELINED_BUS_ACCESS |
assign mem_rdbusy = (((mem_cyc_gbl)||(mem_cyc_lcl))&&(~mem_we)); |
|
// Either the prefetch or the instruction gets the memory bus, but |
939,14 → 863,12
// bus instruction, so they don't need to be checked here. |
// Further, alu_wr includes (set_cond), so we don't need to |
// check for that here either. |
`ifdef OPT_ILLEGAL_INSTRUCTION |
`ifdef NG_ILLEGAL_INSTRUCTION |
assign wr_reg_ce = (~alu_illegal)&&((alu_wr)&&(alu_valid)&&(~clear_pipeline))||(mem_valid); |
`else |
assign wr_reg_ce = ((alu_wr)&&(alu_valid)&&(~clear_pipeline))||(mem_valid); |
`endif |
// Which register shall be written? |
// COULD SIMPLIFY THIS: by adding three bits to these registers, |
// One or PC, one for CC, and one for GIE match |
assign wr_reg_id = (alu_wr)?alu_reg:mem_wreg; |
// Are we writing to the CC register? |
assign wr_write_cc = (wr_reg_id[3:0] == `CPU_CC_REG); |
965,7 → 887,7
// When shall we write to our flags register? alF_wr already |
// includes the set condition ... |
assign wr_flags_ce = (alF_wr)&&(alu_valid)&&(~clear_pipeline)&&(~alu_illegal); |
`ifdef OPT_ILLEGAL_INSTRUCTION |
`ifdef NG_ILLEGAL_INSTRUCTION |
assign w_uflags = { bus_err_flag, trap, ill_err, 1'b0, step, 1'b1, sleep, ((wr_flags_ce)&&(alu_gie))?alu_flags:flags }; |
assign w_iflags = { bus_err_flag, trap, ill_err, break_en, 1'b0, 1'b0, sleep, ((wr_flags_ce)&&(~alu_gie))?alu_flags:iflags }; |
`else |
1017,7 → 939,7
else if ((i_halt)&&(i_dbg_we) |
&&(i_dbg_reg == { 1'b0, `CPU_CC_REG })) |
break_en <= i_dbg_data[`CPU_BREAK_BIT]; |
`ifdef OPT_ILLEGAL_INSTRUCTION |
`ifdef NG_ILLEGAL_INSTRUCTION |
assign o_break = ((break_en)||(~op_gie))&&(op_break) |
&&(~alu_valid)&&(~mem_valid)&&(~mem_busy) |
&&(~clear_pipeline) |
1027,7 → 949,7
assign o_break = (((break_en)||(~op_gie))&&(op_break) |
&&(~alu_valid)&&(~mem_valid)&&(~mem_busy) |
&&(~clear_pipeline)) |
||((~alu_gie)&&(bus_err)); |
||((~alu_gie)&&(bus_err)) |
`endif |
|
|
1062,7 → 984,7
else if ((i_halt)&&(i_dbg_we) |
&&(i_dbg_reg == { 1'b1, `CPU_CC_REG })) |
step <= i_dbg_data[`CPU_STEP_BIT]; |
else if ((alu_pc_valid)&&(step)&&(gie)) |
else if ((master_ce)&&(alu_pc_valid)&&(step)&&(gie)) |
step <= 1'b0; |
|
// The GIE register. Only interrupts can disable the interrupt register |
1070,11 → 992,11
// On interrupt (obviously) |
(i_interrupt) |
// If we are stepping the CPU |
||((alu_pc_valid)&&(step)) |
||((master_ce)&&(alu_pc_valid)&&(step)) |
// If we encounter a break instruction, if the break |
// enable isn't set. |
||((master_ce)&&(~mem_rdbusy)&&(op_break)&&(~break_en)) |
`ifdef OPT_ILLEGAL_INSTRUCTION |
||((master_ce)&&(op_break)&&(~break_en)) |
`ifdef NG_ILLEGAL_INSTRUCTION |
// On an illegal instruction |
||((alu_valid)&&(alu_illegal)) |
`endif |
1114,7 → 1036,7
else if (w_release_from_interrupt) |
trap <= 1'b0; |
|
`ifdef OPT_ILLEGAL_INSTRUCTION |
`ifdef NG_ILLEGAL_INSTRUCTION |
initial ill_err = 1'b0; |
always @(posedge i_clk) |
if (i_rst) |
1123,8 → 1045,6
ill_err <= 1'b0; |
else if ((alu_valid)&&(alu_illegal)&&(gie)) |
ill_err <= 1'b1; |
`else |
assign ill_err = 1'b0; |
`endif |
initial bus_err_flag = 1'b0; |
always @(posedge i_clk) |
1223,5 → 1143,5
// |
assign o_op_stall = (master_ce)&&((~opvalid)||(op_stall)); |
assign o_pf_stall = (master_ce)&&(~pf_valid); |
assign o_i_count = (alu_pc_valid)&&(~clear_pipeline); |
assign o_i_count = alu_pc_valid; |
endmodule |
/trunk/rtl/zipsystem.v
287,8 → 287,6
2'b00, cpu_dbg_cc, |
1'b0, cmd_halt, (~cpu_dbg_stall), 1'b0, |
pic_data[15], cpu_reset, cmd_addr }; |
wire cpu_gie; |
assign cpu_gie = cpu_dbg_cc[1]; |
|
`ifdef USE_TRAP |
// |
370,7 → 368,7
// User task counter |
wire utc_ack, utc_stall, utc_int; |
wire [31:0] utc_data; |
zipcounter utask_ctr(i_clk,(~cpu_halt)&&(cpu_gie), sys_cyc, |
zipcounter utask_ctr(i_clk,(~cpu_halt), sys_cyc, |
(sys_stb)&&(sys_addr == `USER_TASK_CTR), |
sys_we, sys_data, |
utc_ack, utc_stall, utc_data, utc_int); |
378,7 → 376,7
// User Op-Stall counter |
wire uoc_ack, uoc_stall, uoc_int; |
wire [31:0] uoc_data; |
zipcounter umstall_ctr(i_clk,(cpu_op_stall)&&(cpu_gie), sys_cyc, |
zipcounter umstall_ctr(i_clk,(cpu_op_stall), sys_cyc, |
(sys_stb)&&(sys_addr == `USER_MSTL_CTR), |
sys_we, sys_data, |
uoc_ack, uoc_stall, uoc_data, uoc_int); |
386,7 → 384,7
// User PreFetch-Stall counter |
wire upc_ack, upc_stall, upc_int; |
wire [31:0] upc_data; |
zipcounter upstall_ctr(i_clk,(cpu_pf_stall)&&(cpu_gie), sys_cyc, |
zipcounter upstall_ctr(i_clk,(cpu_pf_stall), sys_cyc, |
(sys_stb)&&(sys_addr == `USER_PSTL_CTR), |
sys_we, sys_data, |
upc_ack, upc_stall, upc_data, upc_int); |
394,7 → 392,7
// User instruction counter |
wire uic_ack, uic_stall, uic_int; |
wire [31:0] uic_data; |
zipcounter uins_ctr(i_clk,(cpu_i_count)&&(cpu_gie), sys_cyc, |
zipcounter uins_ctr(i_clk,(cpu_i_count), sys_cyc, |
(sys_stb)&&(sys_addr == `USER_INST_CTR), |
sys_we, sys_data, |
uic_ack, uic_stall, uic_data, uic_int); |
/trunk/rtl/Makefile
32,7 → 32,7
################################################################################ |
# |
.PHONY: all |
all: zipsystem zipbones cpudefs.h |
all: zipsystem |
|
CORED:= core |
PRPHD:= peripherals |
43,14 → 43,9
$(PRPHD)/ziptimer.v $(PRPHD)/ziptrap.v \ |
$(CORED)/zipcpu.v $(CORED)/cpuops.v \ |
$(CORED)/pipefetch.v $(CORED)/prefetch.v \ |
$(CORED)/memops.v $(CORED)/pipemem.v \ |
$(AUXD)/busdelay.v \ |
$(CORED)/memops.v \ |
$(AUXD)/busdelay.v $(AUXD)/wbarbiter.v \ |
$(AUXD)/wbdblpriarb.v $(AUXD)/wbpriarbiter.v |
VZIP := zipbones.v \ |
$(CORED)/zipcpu.v $(CORED)/cpuops.v \ |
$(CORED)/pipefetch.v $(CORED)/prefetch.v \ |
$(CORED)/memops.v $(CORED)/pipemem.v \ |
$(AUXD)/busdelay.v $(AUXD)/wbdblpriarb.v |
|
VOBJ := obj_dir |
|
57,25 → 52,12
$(VOBJ)/Vzipsystem.cpp: $(VSRC) |
verilator -cc -y $(CORED) -y $(PRPHD) -y $(AUXD) zipsystem.v |
|
$(VOBJ)/Vzipbones.cpp: $(VZIP) |
verilator -cc -y $(CORED) -y $(PRPHD) -y $(AUXD) zipbones.v |
|
$(VOBJ)/Vzipsystem__ALL.a: $(VOBJ)/Vzipsystem.cpp $(VOBJ)/Vzipsystem.h |
cd $(VOBJ); make -f Vzipsystem.mk |
|
$(VOBJ)/Vzipbones__ALL.a: $(VOBJ)/Vzipbones.cpp $(VOBJ)/Vzipbones.h |
cd $(VOBJ); make -f Vzipbones.mk |
|
cpudefs.h: $(CORED)/zipcpu.v |
@echo "// Do not edit this file, it is automatically generated!" > $@ |
@grep ^.define $^ | grep OPT_ | sed -e '{ s/^.d/#d/ }' >> $@ |
|
.PHONY: zipsystem |
zipsystem: $(VOBJ)/Vzipsystem__ALL.a |
|
.PHONY: zipbones |
zipbones: $(VOBJ)/Vzipbones__ALL.a |
|
.PHONY: clean |
clean: |
rm -rf $(VOBJ) cpudefs.h |
rm -rf $(VOBJ) |