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

Subversion Repositories zap

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /zap
    from Rev 15 to Rev 14
    Reverse comparison

Rev 15 → Rev 14

/trunk/ZAP/hw/rtl/cpu/zap_core.v
469,59 → 469,7
.o_wb_cyc(o_instr_wb_cyc)
);
 
wire thumb_irq;
wire thumb_fiq;
wire thumb_iabort;
wire [34:0] thumb_instruction;
wire thumb_valid;
wire thumb_und;
wire thumb_force32;
wire [1:0] thumb_bp_state;
wire [31:0] thumb_pc_ff;
wire [31:0] thumb_pc_plus_8_ff;
 
// =========================
// COMPRESSED DECODER STAGE
// =========================
zap_thumb_decoder u_zap_thumb_decoder (
.i_clk (i_clk),
.i_reset (i_reset),
.i_code_stall (1'd0),
.i_clear_from_writeback(clear_from_writeback),
.i_data_stall (
o_data_wb_stb &&
o_data_wb_cyc &&
!i_data_wb_ack
),
.i_clear_from_alu(clear_from_alu),
.i_stall_from_shifter(stall_from_shifter),
.i_stall_from_issue(stall_from_issue),
.i_stall_from_decode(stall_from_decode),
.i_clear_from_decode(clear_from_decode),
 
.i_taken (fifo_bp_state),
.i_instruction (fifo_instruction),
.i_instruction_valid(fifo_valid),
.i_irq (fifo_valid ? irq_sync && !alu_flags_ff[I] : 1'd0), // Pass interrupt only if mask = 0 and instruction exists.
.i_fiq (fifo_valid ? fiq_sync && !alu_flags_ff[F] : 1'd0), // Pass interrupt only if mask = 0 and instruction exists.
.i_iabort (fifo_instr_abort),
.o_iabort (thumb_iabort),
.i_cpsr_ff_t (alu_flags_ff[T]),
.i_pc_ff (fifo_pc_plus_8 - 32'd8),
.i_pc_plus_8_ff (fifo_pc_plus_8),
 
.o_instruction (thumb_instruction),
.o_instruction_valid (thumb_valid),
.o_und (thumb_und),
.o_force32_align(thumb_force32),
.o_pc_ff (thumb_pc_ff),
.o_pc_plus_8_ff (thumb_pc_plus_8_ff),
.o_irq (thumb_irq),
.o_fiq (thumb_fiq),
.o_taken_ff (thumb_bp_state)
);
 
// =========================
// PREDECODE STAGE
// =========================
zap_predecode_main #(
545,26 → 493,22
.i_clear_from_alu (clear_from_alu),
.i_stall_from_shifter (stall_from_shifter),
.i_stall_from_issue (stall_from_issue),
.i_irq (irq_sync),
.i_fiq (fiq_sync),
 
.i_irq (thumb_irq),
.i_fiq (thumb_fiq),
.i_abt (fifo_instr_abort),
.i_pc_plus_8_ff (fifo_pc_plus_8),
.i_pc_ff (fifo_pc_plus_8 - 32'd8),
 
.i_abt (thumb_iabort),
.i_pc_plus_8_ff (thumb_pc_plus_8_ff),
.i_pc_ff (thumb_pc_plus_8_ff - 32'd8),
 
.i_cpu_mode_t (alu_flags_ff[T]),
// .i_cpu_mode_f (alu_flags_ff[F]),
// .i_cpu_mode_i (alu_flags_ff[I]),
.i_cpu_mode_f (alu_flags_ff[F]),
.i_cpu_mode_i (alu_flags_ff[I]),
.i_cpu_mode_mode (alu_flags_ff[`CPSR_MODE]),
 
.i_instruction (thumb_instruction),
.i_instruction_valid (thumb_valid),
.i_taken (thumb_bp_state),
.i_instruction (fifo_instruction),
.i_instruction_valid (fifo_valid),
.i_taken (fifo_bp_state),
 
.i_force32 (thumb_force32),
.i_und (thumb_und),
 
.i_copro_done (copro_done),
.i_pipeline_dav (
predecode_val ||
/trunk/ZAP/hw/rtl/cpu/zap_predecode_coproc.v
32,7 → 32,7
input wire i_reset,
 
// Instruction and valid qualifier.
input wire [34:0] i_instruction,
input wire [31:0] i_instruction,
input wire i_valid,
 
// CPSR Thumb Bit.
63,7 → 63,7
output reg o_fiq,
 
// Instruction and valid qualifier.
output reg [34:0] o_instruction,
output reg [31:0] o_instruction,
output reg o_valid,
 
// We can generate stall if coprocessor is slow. We also have
108,12 → 108,6
 
///////////////////////////////////////////////////////////////////////////////
 
wire c1 = !i_cpsr_ff_t;
wire c2 = i_cpsr_ff_mode != USR;
wire c3 = i_instruction[11:8] == 4'b1111;
wire c4 = i_instruction[34:32] == 3'd0;
wire c5 = c1 & c2 & c3 & c4;
 
// Next state logic.
always @*
begin
130,7 → 124,7
case ( state_ff )
IDLE:
// Activate only if no thumb, not in USER mode and CP15 access is requested.
casez ( (!i_cpsr_ff_t && (i_cpsr_ff_mode != USR) & (i_instruction[11:8] == 4'b1111) & (i_instruction[34:32] == 3'd0)) ? i_instruction[31:0] : 35'd0 )
casez ( (!i_cpsr_ff_t && (i_cpsr_ff_mode != USR) & (i_instruction[11:8] == 4'b1111)) ? i_instruction : 32'd0 )
MRC, MCR, LDC, STC, CDP:
begin
// Send ANDNV R0, R0, R0 instruction.
/trunk/ZAP/hw/rtl/cpu/zap_predecode_main.v
58,8 → 58,6
 
// Branch state.
input wire [1:0] i_taken,
input wire i_force32,
input wire i_und,
 
// Clear and stall signals. From high to low priority.
input wire i_code_stall,
86,10 → 84,12
 
// CPU mode. Taken from CPSR in the ALU.
input wire i_cpu_mode_t, // T mode.
i_cpu_mode_i, // I mask.
i_cpu_mode_f, // F mask.
input wire [4:0] i_cpu_mode_mode, // CPU mode.
 
// Instruction input.
input wire [34:0] i_instruction,
input wire [31:0] i_instruction,
input wire i_instruction_valid,
 
// Instruction output
139,6 → 139,11
 
///////////////////////////////////////////////////////////////////////////////
 
wire o_comp_und_nxt;
wire [3:0] o_condition_code_nxt;
wire o_irq_nxt;
wire o_fiq_nxt;
wire o_abt_nxt;
wire [35:0] o_instruction_nxt;
wire o_instruction_valid_nxt;
 
149,20 → 154,23
 
wire [34:0] arm_instruction;
wire arm_instruction_valid;
wire o_force32align_nxt;
 
wire cp_stall;
wire [34:0] cp_instruction;
wire [31:0] cp_instruction;
wire cp_instruction_valid;
wire cp_irq;
wire cp_fiq;
 
wire o_irq_nxt;
wire o_fiq_nxt;
 
reg [1:0] taken_nxt;
 
///////////////////////////////////////////////////////////////////////////////
 
// Abort
assign o_abt_nxt = i_abt;
 
///////////////////////////////////////////////////////////////////////////////
 
// Flop the outputs to break the pipeline at this point.
always @ (posedge i_clk)
begin
198,13 → 206,13
else
begin
// Do not pass IRQ and FIQ if mask is 1.
o_irq_ff <= i_irq;
o_fiq_ff <= i_fiq;
o_abt_ff <= i_abt;
o_und_ff <= i_und && i_instruction_valid;
o_irq_ff <= o_irq_nxt & !i_cpu_mode_i;
o_fiq_ff <= o_fiq_nxt & !i_cpu_mode_f;
o_abt_ff <= o_abt_nxt;
o_und_ff <= o_comp_und_nxt && i_instruction_valid;
o_pc_plus_8_ff <= i_pc_plus_8_ff;
o_pc_ff <= i_pc_ff;
o_force32align_ff <= i_force32;
o_force32align_ff <= o_force32align_nxt;
o_taken_ff <= taken_nxt;
o_instruction_ff <= o_instruction_nxt;
o_instruction_valid_ff <= o_instruction_valid_nxt;
230,6 → 238,10
 
///////////////////////////////////////////////////////////////////////////////
 
generate
begin: gblk1
if ( COPROCESSOR_INTERFACE_ENABLE ) begin: cm_en
 
// This unit handles coprocessor stuff.
zap_predecode_coproc
#(
240,8 → 252,8
// Inputs from outside world.
.i_clk(i_clk),
.i_reset(i_reset),
.i_irq(i_irq),
.i_fiq(i_fiq),
.i_irq(i_instruction_valid ? i_irq : 1'd0),
.i_fiq(i_instruction_valid ? i_fiq : 1'd0),
.i_instruction(i_instruction_valid ? i_instruction : 32'd0),
.i_valid(i_instruction_valid),
.i_cpsr_ff_t(i_cpu_mode_t),
275,15 → 287,67
.o_copro_word_ff(o_copro_word_ff)
);
 
end
else // Else generate block.
begin: cm_dis
 
assign cp_instruction = i_instruction_valid ? i_instruction : 32'd0;
assign cp_instruction_valid = i_instruction_valid;
assign cp_irq = i_instruction_valid ? i_irq : 1'd0;
assign cp_fiq = i_instruction_valid ? i_fiq : 1'd0;
assign cp_stall = 1'd0;
assign o_copro_dav_ff = 1'd0;
assign o_copro_word_ff = 32'd0;
 
end
 
end
endgenerate
 
///////////////////////////////////////////////////////////////////////////////
 
assign arm_instruction = cp_instruction;
assign arm_instruction_valid = cp_instruction_valid;
assign arm_irq = cp_irq;
assign arm_fiq = cp_fiq;
generate
begin: gblk2
if ( COMPRESSED_EN )
begin: cmp_en
 
// Implements a custom 16-bit compressed instruction set.
zap_predecode_compress
u_zap_predecode_compress
(
.i_clk(i_clk),
.i_reset(i_reset),
.i_irq(cp_irq),
.i_fiq(cp_fiq),
.i_instruction(cp_instruction),
.i_instruction_valid(cp_instruction_valid),
.i_cpsr_ff_t(i_cpu_mode_t),
 
.i_code_stall(i_code_stall),
.o_instruction(arm_instruction),
.o_instruction_valid(arm_instruction_valid),
.o_irq(arm_irq),
.o_fiq(arm_fiq),
.o_force32_align(o_force32align_nxt),
.o_und(o_comp_und_nxt)
);
 
end
else
begin: cmp_dis
 
assign arm_instruction = cp_instruction;
assign arm_instruction_valid = cp_instruction_valid;
assign arm_irq = cp_irq;
assign arm_fiq = cp_fiq;
assign o_force32align_nxt = 1'd0;
assign o_comp_und_nxt = 1'd0;
 
end
end
endgenerate
 
///////////////////////////////////////////////////////////////////////////////
 
always @*
/trunk/ZAP/hw/rtl/tlb/zap_tlb_fsm.v
96,10 → 96,9
localparam FETCH_L1_DESC = 1; /* Fetch L1 descriptor */
localparam FETCH_L2_DESC = 2; /* Fetch L2 descriptor */
localparam REFRESH_CYCLE = 3; /* Refresh TLBs and cache */
localparam FETCH_L1_DESC_0 = 4;
localparam FETCH_L2_DESC_0 = 5;
localparam NUMBER_OF_STATES = 6;
 
localparam NUMBER_OF_STATES = 4;
 
// ----------------------------------------------------------------------------
 
reg [3:0] dff_ff, dff_nxt; /* Scratchpad register */
130,8 → 129,6
 
assign o_unused_ok = 0 || i_baddr[13:0];
 
reg [31:0] dff, dnxt;
 
/* Combinational logic */
always @*
begin: blk1
158,8 → 155,6
dff_nxt = dff_ff;
state_nxt = state_ff;
 
dnxt = dff;
 
case ( state_ff )
IDLE:
begin
184,7 → 179,7
tsk_prpr_wb_rd({i_baddr[`VA__TRANSLATION_BASE],
i_address[`VA__TABLE_INDEX], 2'd0});
 
state_nxt = FETCH_L1_DESC_0;
state_nxt = FETCH_L1_DESC;
end
else if ( i_fsr[3:0] != 4'b0000 ) /* Access Violation. */
begin
208,17 → 203,6
end
end
 
FETCH_L1_DESC_0:
begin
o_busy = 1;
if ( i_wb_ack )
begin
dnxt = i_wb_dat;
state_nxt = FETCH_L1_DESC;
end
else tsk_hold_wb_access;
end
 
FETCH_L1_DESC:
begin
/*
230,13 → 214,13
 
o_busy = 1'd1;
 
if ( 1 )
if ( i_wb_ack ) /* Wait for ACK. */
begin
$display($time, "%m :: ACK received. Read data is %x", i_wb_dat);
`ifdef TLB_DEBUG
$stop;
`endif
case ( dff[`ID] )
case ( i_wb_dat[`ID] )
 
SECTION_ID:
begin
247,7 → 231,7
*/
o_setlb_wen = 1'd1;
o_setlb_wdata = {i_address[`VA__SECTION_TAG],
dff};
i_wb_dat};
state_nxt = REFRESH_CYCLE;
 
$display($time, "%m :: It is a section ID. Writing to section TLB as %x. Moving to refresh cycle...", o_setlb_wdata);
264,10 → 248,10
* reload the TLB, it would be useful. Anyway,
* we need to initiate another access.
*/
dff_nxt = dff[`L1_PAGE__DAC_SEL];
state_nxt = FETCH_L2_DESC_0;
dff_nxt = i_wb_dat[`L1_PAGE__DAC_SEL];
state_nxt = FETCH_L2_DESC;
 
tsk_prpr_wb_rd({dff[`L1_PAGE__PTBR],
tsk_prpr_wb_rd({i_wb_dat[`L1_PAGE__PTBR],
i_address[`VA__L2_TABLE_INDEX], 2'd0});
 
$display($time, "%m :: Page ID.");
279,7 → 263,7
default: /* Generate section translation fault. Fault Class II */
begin
o_fsr = FSR_SECTION_TRANSLATION_FAULT;
o_fsr = {dff[`L1_SECTION__DAC_SEL], o_fsr[3:0]};
o_fsr = {i_wb_dat[`L1_SECTION__DAC_SEL], o_fsr[3:0]};
o_far = i_address;
o_fault = 1'd1;
o_busy = 1'd0;
296,31 → 280,21
else tsk_hold_wb_access;
end
 
FETCH_L2_DESC_0:
begin
o_busy = 1;
if ( i_wb_ack )
begin
dnxt = i_wb_dat;
state_nxt = FETCH_L2_DESC;
end else tsk_hold_wb_access;
end
 
FETCH_L2_DESC:
begin
o_busy = 1'd1;
 
if ( 1 ) //i_wb_ack )
if ( i_wb_ack )
begin
case ( dff[`ID] )
case ( i_wb_dat[`ID] )
SPAGE_ID:
begin
/* Update TLB */
o_sptlb_wen = 1'd1;
 
o_sptlb_wdata = { dff[`VA__SPAGE_TAG],
o_sptlb_wdata = { i_wb_dat[`VA__SPAGE_TAG],
dff_ff[3:0], /* DAC Selector from L1 */
dff };
i_wb_dat };
 
state_nxt = REFRESH_CYCLE;
end
331,8 → 305,8
o_lptlb_wen = 1'd1;
 
/* DAC is inserted in between to save bits */
o_lptlb_wdata = {dff[`VA__LPAGE_TAG],
dff};
o_lptlb_wdata = {i_wb_dat[`VA__LPAGE_TAG],
i_wb_dat};
o_lptlb_wdata[`LPAGE_TLB__DAC_SEL] = dff_ff[3:0];
 
state_nxt = REFRESH_CYCLE;
343,7 → 317,7
o_busy = 1'd0;
o_fault = 1'd1;
o_fsr = FSR_PAGE_TRANSLATION_FAULT;
o_fsr = {dff[`L1_PAGE__DAC_SEL], o_fsr[3:0]};
o_fsr = {i_wb_dat[`L1_PAGE__DAC_SEL], o_fsr[3:0]};
o_far = i_address;
state_nxt = IDLE;
end
387,7 → 361,6
wb_adr_ff <= wb_adr_nxt;
dff_ff <= dff_nxt;
wb_sel_ff <= wb_sel_nxt;
dff <= dnxt;
end
end
 
/trunk/ZAP/hw/rtl/rtl_files.list
26,7 → 26,6
${ZAP_HOME}/hw/rtl/cache/zap_cache_tag_ram.v
${ZAP_HOME}/hw/rtl/cache/zap_cache.v
${ZAP_HOME}/hw/rtl/wb/zap_wb_merger.v
${ZAP_HOME}/hw/rtl/cpu/zap_thumb_decoder.v
 
+libdir+${ZAP_HOME}/hw/rtl/lib/
+incdir+${ZAP_HOME}/hw/rtl/inc

powered by: WebSVN 2.1.0

© copyright 1999-2022 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.