Standardise "subheadings" in code comments

The code base made extensive use of ASCII art headings/subheadings in
comments to delineate code. Switch to a more space efficient and easier
to edit format:

/////////
// Foo //
/////////
This commit is contained in:
Alex Bradbury 2019-04-24 15:36:50 +01:00 committed by Philipp Wagner
parent af77da9673
commit 7e81f6f4eb
14 changed files with 179 additions and 351 deletions

View file

@ -50,14 +50,9 @@ module ibex_alu (
assign operand_a_rev[k] = operand_a_i[31-k];
end
/////////////////////////////////////
// _ _ _ //
// / \ __| | __| | ___ _ __ //
// / _ \ / _` |/ _` |/ _ \ '__| //
// / ___ \ (_| | (_| | __/ | //
// /_/ \_\__,_|\__,_|\___|_| //
// //
/////////////////////////////////////
///////////
// Adder //
///////////
logic adder_op_b_negate;
logic [32:0] adder_in_a, adder_in_b;
@ -97,14 +92,9 @@ module ibex_alu (
assign adder_result_o = adder_result;
////////////////////////////////////////
// ____ _ _ ___ _____ _____ //
// / ___|| | | |_ _| ___|_ _| //
// \___ \| |_| || || |_ | | //
// ___) | _ || || _| | | //
// |____/|_| |_|___|_| |_| //
// //
////////////////////////////////////////
///////////
// Shift //
///////////
logic shift_left; // should we shift left
logic shift_arithmetic;
@ -138,14 +128,9 @@ module ibex_alu (
assign shift_result = shift_left ? shift_left_result : shift_right_result;
//////////////////////////////////////////////////////////////////
// ____ ___ __ __ ____ _ ____ ___ ____ ___ _ _ //
// / ___/ _ \| \/ | _ \ / \ | _ \|_ _/ ___| / _ \| \ | | //
// | | | | | | |\/| | |_) / _ \ | |_) || |\___ \| | | | \| | //
// | |__| |_| | | | | __/ ___ \| _ < | | ___) | |_| | |\ | //
// \____\___/|_| |_|_| /_/ \_\_| \_\___|____/ \___/|_| \_| //
// //
//////////////////////////////////////////////////////////////////
////////////////
// Comparison //
////////////////
logic is_equal;
logic is_greater_equal; // handles both signed and unsigned forms
@ -220,14 +205,9 @@ module ibex_alu (
////////////////////////////////////////////////////////
// ____ _ _ __ __ //
// | _ \ ___ ___ _ _| | |_ | \/ |_ ___ __ //
// | |_) / _ \/ __| | | | | __| | |\/| | | | \ \/ / //
// | _ < __/\__ \ |_| | | |_ | | | | |_| |> < //
// |_| \_\___||___/\__,_|_|\__| |_| |_|\__,_/_/\_\ //
// //
////////////////////////////////////////////////////////
////////////////
// Result mux //
////////////////
always_comb begin
result_o = '0;

View file

@ -30,14 +30,9 @@ module ibex_compressed_decoder (
);
import ibex_defines::*;
////////////////////////////////////////////////////////////////////////////////////////////
// ____ __ _ ____ _ //
// / ___|___ _ __ ___ _ __ _ __ /_/ ___ __| | | _ \ ___ ___ ___ __| | ___ _ __ //
// | | / _ \| '_ ` _ \| '_ \| '__/// / __|/ _` | | | | |/ _ \/ __/ _ \ / _` |/ _ \ '__| //
// | |__| (_) | | | | | | |_) | | \__ \ (_| | | |_| | __/ (_| (_) | (_| | __/ | //
// \____\___/|_| |_| |_| .__/|_| |___/\__,_| |____/ \___|\___\___/ \__,_|\___|_| //
// |_| //
/////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////
// Compressed decoder //
////////////////////////
always_comb begin
illegal_instr_o = 1'b0;

View file

@ -141,15 +141,9 @@ module ibex_controller (
`endif
////////////////////////////////////////////////////////////////////////////////////////////
// ____ ___ ____ _____ ____ ___ _ _ _____ ____ ___ _ _ _____ ____ //
// / ___/ _ \| _ \| ____| / ___/ _ \| \ | |_ _| _ \ / _ \| | | | | ____| _ \ //
// | | | | | | |_) | _| | | | | | | \| | | | | |_) | | | | | | | | _| | |_) | //
// | |__| |_| | _ <| |___ | |__| |_| | |\ | | | | _ <| |_| | |___| |___| |___| _ < //
// \____\___/|_| \_\_____| \____\___/|_| \_| |_| |_| \_\\___/|_____|_____|_____|_| \_\ //
// //
////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////
// Core controller //
/////////////////////
always_comb begin
// Default values
@ -500,14 +494,9 @@ module ibex_controller (
endcase
end
/////////////////////////////////////////////////////////////
// ____ _ _ _ ____ _ _ //
// / ___|| |_ __ _| | | / ___|___ _ __ | |_ _ __ ___ | | //
// \___ \| __/ _` | | | | | / _ \| '_ \| __| '__/ _ \| | //
// ___) | || (_| | | | | |__| (_) | | | | |_| | | (_) | | //
// |____/ \__\__,_|_|_| \____\___/|_| |_|\__|_| \___/|_| //
// //
/////////////////////////////////////////////////////////////
///////////////////
// Stall control //
///////////////////
// deassert WE when the core is not decoding instructions
// or in case of illegal instruction

View file

@ -187,14 +187,9 @@ module ibex_core #(
logic perf_tbranch;
//////////////////////////////////////////////////////////////////////////////////////////////
// ____ _ _ __ __ _ //
// / ___| | ___ ___| | __ | \/ | __ _ _ __ __ _ __ _ ___ _ __ ___ ___ _ __ | |_ //
// | | | |/ _ \ / __| |/ / | |\/| |/ _` | '_ \ / _` |/ _` |/ _ \ '_ ` _ \ / _ \ '_ \| __| //
// | |___| | (_) | (__| < | | | | (_| | | | | (_| | (_| | __/ | | | | | __/ | | | |_ //
// \____|_|\___/ \___|_|\_\ |_| |_|\__,_|_| |_|\__,_|\__, |\___|_| |_| |_|\___|_| |_|\__| //
// |___/ //
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////
// Clock management //
//////////////////////
logic clk;
@ -231,14 +226,10 @@ module ibex_core #(
.clk_o ( clk )
);
//////////////////////////////////////////////////
// ___ _____ ____ _____ _ ____ _____ //
// |_ _| ___| / ___|_ _|/ \ / ___| ____| //
// | || |_ \___ \ | | / _ \| | _| _| //
// | || _| ___) || |/ ___ \ |_| | |___ //
// |___|_| |____/ |_/_/ \_\____|_____| //
// //
//////////////////////////////////////////////////
//////////////
// IF stage //
//////////////
ibex_if_stage #(
.DM_HALT_ADDRESS ( DM_HALT_ADDRESS ),
.DM_EXCEPTION_ADDRESS ( DM_EXCEPTION_ADDRESS )
@ -289,14 +280,10 @@ module ibex_core #(
);
/////////////////////////////////////////////////
// ___ ____ ____ _____ _ ____ _____ //
// |_ _| _ \ / ___|_ _|/ \ / ___| ____| //
// | || | | | \___ \ | | / _ \| | _| _| //
// | || |_| | ___) || |/ ___ \ |_| | |___ //
// |___|____/ |____/ |_/_/ \_\____|_____| //
// //
/////////////////////////////////////////////////
//////////////
// ID stage //
//////////////
ibex_id_stage #(
.RV32E(RV32E),
.RV32M(RV32M)
@ -435,14 +422,9 @@ module ibex_core #(
.ex_ready_o ( ex_ready )
);
////////////////////////////////////////////////////////////////////////////////////////
// _ ___ _ ____ ____ _____ ___ ____ _____ _ _ _ _ ___ _____ //
// | | / _ \ / \ | _ \ / ___|_ _/ _ \| _ \| ____| | | | | \ | |_ _|_ _| //
// | | | | | |/ _ \ | | | | \___ \ | || | | | |_) | _| | | | | \| || | | | //
// | |__| |_| / ___ \| |_| | ___) || || |_| | _ <| |___ | |_| | |\ || | | | //
// |_____\___/_/ \_\____/ |____/ |_| \___/|_| \_\_____| \___/|_| \_|___| |_| //
// //
////////////////////////////////////////////////////////////////////////////////////////
/////////////////////
// Load/store unit //
/////////////////////
ibex_load_store_unit load_store_unit_i (
.clk ( clk ),
@ -486,15 +468,9 @@ module ibex_core #(
);
//////////////////////////////////////
// ____ ____ ____ //
// / ___/ ___|| _ \ ___ //
// | | \___ \| |_) / __| //
// | |___ ___) | _ <\__ \ //
// \____|____/|_| \_\___/ //
// //
// Control and Status Registers //
//////////////////////////////////////
/////////////////////////////////////////
// CSRs (Control and Status Registers) //
/////////////////////////////////////////
ibex_cs_registers #(
.N_EXT_CNT ( N_EXT_PERF_COUNTERS ),

View file

@ -192,14 +192,9 @@ module ibex_cs_registers #(
Status_t mstatus_q, mstatus_n;
logic [31:0] exception_pc;
////////////////////////////////////////////
// ____ ____ ____ ____ //
// / ___/ ___|| _ \ | _ \ ___ __ _ //
// | | \___ \| |_) | | |_) / _ \/ _` | //
// | |___ ___) | _ < | _ < __/ (_| | //
// \____|____/|_| \_\ |_| \_\___|\__, | //
// |___/ //
////////////////////////////////////////////
/////////////
// CSR reg //
/////////////
// read logic
always_comb begin
@ -407,14 +402,9 @@ module ibex_cs_registers #(
end
end
/////////////////////////////////////////////////////////////////
// ____ __ ____ _ //
// | _ \ ___ _ __ / _| / ___|___ _ _ _ __ | |_ ___ _ __ //
// | |_) / _ \ '__| |_ | | / _ \| | | | '_ \| __/ _ \ '__| //
// | __/ __/ | | _| | |__| (_) | |_| | | | | || __/ | //
// |_| \___|_| |_|(_) \____\___/ \__,_|_| |_|\__\___|_| //
// //
/////////////////////////////////////////////////////////////////
//////////////////////////
// Performance counters //
//////////////////////////
assign PCCR_in[0] = 1'b1; // cycle counter
assign PCCR_in[1] = if_valid_i; // instruction counter

View file

@ -95,14 +95,9 @@ module ibex_decoder #(
logic [1:0] csr_op;
logic csr_illegal;
/////////////////////////////////////////////
// ____ _ //
// | _ \ ___ ___ ___ __| | ___ _ __ //
// | | | |/ _ \/ __/ _ \ / _` |/ _ \ '__| //
// | |_| | __/ (_| (_) | (_| | __/ | //
// |____/ \___|\___\___/ \__,_|\___|_| //
// //
/////////////////////////////////////////////
/////////////
// Decoder //
/////////////
always_comb begin
jump_in_id = 1'b0;
@ -141,14 +136,9 @@ module ibex_decoder #(
unique case (instr_rdata_i[6:0])
//////////////////////////////////////
// _ _ _ __ __ ____ ____ //
// | | | | | \/ | _ \/ ___| //
// _ | | | | | |\/| | |_) \___ \ //
// | |_| | |_| | | | | __/ ___) | //
// \___/ \___/|_| |_|_| |____/ //
// //
//////////////////////////////////////
///////////
// Jumps //
///////////
OPCODE_JAL: begin // Jump and Link
jump_in_id = 1'b1;
@ -216,14 +206,9 @@ module ibex_decoder #(
end
//////////////////////////////////
// _ ____ ______ _____ //
// | | | _ \ / / ___|_ _| //
// | | | | | |/ /\___ \ | | //
// | |___| |_| / / ___) || | //
// |_____|____/_/ |____/ |_| //
// //
//////////////////////////////////
////////////////
// Load/store //
////////////////
OPCODE_STORE: begin
data_req = 1'b1;
@ -303,14 +288,9 @@ module ibex_decoder #(
end
//////////////////////////
// _ _ _ _ //
// / \ | | | | | | //
// / _ \ | | | | | | //
// / ___ \| |__| |_| | //
// /_/ \_\_____\___/ //
// //
//////////////////////////
/////////
// ALU //
/////////
OPCODE_LUI: begin // Load Upper Immediate
alu_op_a_mux_sel_o = OP_A_IMM;
@ -445,14 +425,9 @@ module ibex_decoder #(
end
end
////////////////////////////////////////////////
// ____ ____ _____ ____ ___ _ _ //
// / ___|| _ \| ____/ ___|_ _| / \ | | //
// \___ \| |_) | _|| | | | / _ \ | | //
// ___) | __/| |__| |___ | | / ___ \| |___ //
// |____/|_| |_____\____|___/_/ \_\_____| //
// //
////////////////////////////////////////////////
/////////////
// Special //
/////////////
OPCODE_MISC_MEM: begin
// For now, treat the fence (funct3 == 000) instruction as a nop.

View file

@ -92,14 +92,9 @@ module ibex_ex_block #(
assign branch_decision_o = alu_cmp_result;
assign jump_target_o = alu_adder_result_ex_o;
////////////////////////////
// _ _ _ _ //
// / \ | | | | | | //
// / _ \ | | | | | | //
// / ___ \| |__| |_| | //
// /_/ \_\_____\___/ //
// //
////////////////////////////
/////////
// ALU //
/////////
ibex_alu alu_i (
.operator_i ( alu_operator_i ),
@ -115,14 +110,9 @@ module ibex_ex_block #(
.is_equal_result_o ( alu_is_equal_result )
);
////////////////////////////////////////////////////////////////
// __ __ _ _ _ _____ ___ ____ _ ___ _____ ____ //
// | \/ | | | | | |_ _|_ _| _ \| | |_ _| ____| _ \ //
// | |\/| | | | | | | | | || |_) | | | || _| | |_) | //
// | | | | |_| | |___| | | || __/| |___ | || |___| _ < //
// |_| |_|\___/|_____|_| |___|_| |_____|___|_____|_| \_\ //
// //
////////////////////////////////////////////////////////////////
////////////////
// Multiplier //
////////////////
if (!MULT_TYPE) begin : gen_multdiv_slow
ibex_multdiv_slow multdiv_i (

View file

@ -61,9 +61,9 @@ module ibex_fetch_fifo (
logic aligned_is_compressed, unaligned_is_compressed;
logic unaligned_is_compressed_st;
//////////////////////////////////////////////////////////////////////////////
// output port
//////////////////////////////////////////////////////////////////////////////
/////////////////
// Output port //
/////////////////
assign rdata = valid_Q[0] ? rdata_Q[0] : in_rdata_i;
@ -78,9 +78,9 @@ module ibex_fetch_fifo (
assign aligned_is_compressed = rdata[ 1: 0] != 2'b11;
assign unaligned_is_compressed_st = rdata_Q[0][17:16] != 2'b11;
//////////////////////////////////////////////////////////////////////////////
// instruction aligner (if unaligned)
//////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////
// Instruction aligner (if unaligned) //
////////////////////////////////////////
always_comb begin
// serve the aligned case even though the output address is unaligned when
@ -120,18 +120,18 @@ module ibex_fetch_fifo (
end
//////////////////////////////////////////////////////////////////////////////
// input port
//////////////////////////////////////////////////////////////////////////////
////////////////
// input port //
////////////////
// we accept data as long as our fifo is not full
// we don't care about clear here as the data will be received one cycle
// later anyway
assign in_ready_o = ~valid_Q[DEPTH-2];
//////////////////////////////////////////////////////////////////////////////
// FIFO management
//////////////////////////////////////////////////////////////////////////////
/////////////////////
// FIFO management //
/////////////////////
always_comb begin
addr_int = addr_Q;
@ -180,9 +180,9 @@ module ibex_fetch_fifo (
end
end
//////////////////////////////////////////////////////////////////////////////
// registers
//////////////////////////////////////////////////////////////////////////////
///////////////
// registers //
///////////////
always_ff @(posedge clk, negedge rst_n) begin
if (!rst_n) begin
@ -202,9 +202,9 @@ module ibex_fetch_fifo (
end
end
//----------------------------------------------------------------------------
// Assertions
//----------------------------------------------------------------------------
////////////////
// Assertions //
////////////////
`ifndef VERILATOR
assert property (
@(posedge clk) (in_valid_i) |-> ((valid_Q[DEPTH-1] == 1'b0) || (clear_i == 1'b1)) );

View file

@ -263,15 +263,15 @@ module ibex_id_stage #(
assign imm_vs_type = { {26 {instr[24]}}, instr[24:20], instr[25] };
assign imm_vu_type = { 26'b0, instr[24:20], instr[25] };
//---------------------------------------------------------------------------
// source register selection
//---------------------------------------------------------------------------
///////////////////////////////
// Source register selection //
///////////////////////////////
assign regfile_addr_ra_id = instr[`REG_S1];
assign regfile_addr_rb_id = instr[`REG_S2];
//---------------------------------------------------------------------------
// destination registers
//---------------------------------------------------------------------------
///////////////////////////
// Destination registers //
///////////////////////////
assign regfile_alu_waddr_id = instr[`REG_D];
//if (RV32E)
@ -287,14 +287,9 @@ module ibex_id_stage #(
assign branch_taken_ex = branch_in_id & branch_decision_i;
////////////////////////////////////////////////////////
// ___ _ _ //
// / _ \ _ __ ___ _ __ __ _ _ __ __| | / \ //
// | | | | '_ \ / _ \ '__/ _` | '_ \ / _` | / _ \ //
// | |_| | |_) | __/ | | (_| | | | | (_| | / ___ \ //
// \___/| .__/ \___|_| \__,_|_| |_|\__,_| /_/ \_\ //
// |_| //
////////////////////////////////////////////////////////
///////////////
// Operand A //
///////////////
// ALU_Op_a Mux
always_comb begin : alu_operand_a_mux
@ -318,14 +313,9 @@ module ibex_id_stage #(
end
//////////////////////////////////////////////////////
// ___ _ ____ //
// / _ \ _ __ ___ _ __ __ _ _ __ __| | | __ ) //
// | | | | '_ \ / _ \ '__/ _` | '_ \ / _` | | _ \ //
// | |_| | |_) | __/ | | (_| | | | | (_| | | |_) | //
// \___/| .__/ \___|_| \__,_|_| |_|\__,_| |____/ //
// |_| //
//////////////////////////////////////////////////////
///////////////
// Operand B //
///////////////
// Immediate Mux for operand B
always_comb begin : immediate_b_mux
@ -357,14 +347,9 @@ module ibex_id_stage #(
assign alu_operand_b = operand_b;
assign operand_b_fw_id = regfile_data_rb_id;
/////////////////////////////////////////////////////////
// ____ _____ ____ ___ ____ _____ _____ ____ ____ //
// | _ \| ____/ ___|_ _/ ___|_ _| ____| _ \/ ___| //
// | |_) | _|| | _ | |\___ \ | | | _| | |_) \___ \ //
// | _ <| |__| |_| || | ___) || | | |___| _ < ___) | //
// |_| \_\_____\____|___|____/ |_| |_____|_| \_\____/ //
// //
/////////////////////////////////////////////////////////
///////////////
// Registers //
///////////////
logic [31:0] regfile_wdata_mux;
logic regfile_we_mux;
@ -404,14 +389,9 @@ module ibex_id_stage #(
assign multdiv_int_en = mult_int_en | div_int_en;
///////////////////////////////////////////////
// ____ _____ ____ ___ ____ _____ ____ //
// | _ \| ____/ ___/ _ \| _ \| ____| _ \ //
// | | | | _|| | | | | | | | | _| | |_) | //
// | |_| | |__| |__| |_| | |_| | |___| _ < //
// |____/|_____\____\___/|____/|_____|_| \_\ //
// //
///////////////////////////////////////////////
/////////////
// Decoder //
/////////////
ibex_decoder #( .RV32M(RV32M)) decoder_i (
// controller related signals
@ -463,14 +443,9 @@ module ibex_id_stage #(
.branch_in_id_o ( branch_in_id )
);
////////////////////////////////////////////////////////////////////
// ____ ___ _ _ _____ ____ ___ _ _ _____ ____ //
// / ___/ _ \| \ | |_ _| _ \ / _ \| | | | | ____| _ \ //
// | | | | | | \| | | | | |_) | | | | | | | | _| | |_) | //
// | |__| |_| | |\ | | | | _ <| |_| | |___| |___| |___| _ < //
// \____\___/|_| \_| |_| |_| \_\\___/|_____|_____|_____|_| \_\ //
// //
////////////////////////////////////////////////////////////////////
////////////////
// Controller //
////////////////
ibex_controller controller_i (
.clk ( clk ),
@ -557,15 +532,9 @@ module ibex_id_stage #(
.perf_tbranch_o ( perf_tbranch_o )
);
////////////////////////////////////////////////////////////////////////
// _____ _ _____ _ _ _ //
// |_ _| | | / __ \ | | | | | //
// | | _ __ | |_ | / \/ ___ _ __ | |_ _ __ ___ | | | ___ _ __ //
// | || '_ \| __| | | / _ \| '_ \| __| '__/ _ \| | |/ _ \ '__| //
// _| || | | | |_ _ | \__/\ (_) | | | | |_| | | (_) | | | __/ | //
// \___/_| |_|\__(_) \____/\___/|_| |_|\__|_| \___/|_|_|\___|_| //
// //
////////////////////////////////////////////////////////////////////////
//////////////////////////
// Interrupt controller //
//////////////////////////
ibex_int_controller int_controller_i (
.clk ( clk ),
@ -585,14 +554,9 @@ module ibex_id_stage #(
.m_IE_i ( m_irq_enable_i )
);
/////////////////////////////////////
// ___ ____ _______ __ //
// |_ _| _ \ | ____\ \/ / //
// | || | | |_____| _| \ / //
// | || |_| |_____| |___ / \ //
// |___|____/ |_____/_/\_\ //
// //
/////////////////////////////////////
///////////
// ID-EX //
///////////
assign data_we_ex_o = data_we_id;
assign data_type_ex_o = data_type_id;
@ -619,9 +583,9 @@ module ibex_id_stage #(
typedef enum logic { IDLE, WAIT_MULTICYCLE } id_fsm_e;
id_fsm_e id_wb_fsm_cs, id_wb_fsm_ns;
///////////////////////////////////////
// ID-EX/WB Pipeline Register //
///////////////////////////////////////
////////////////////////////////
// ID-EX/WB Pipeline Register //
////////////////////////////////
always_ff @(posedge clk, negedge rst_n) begin : EX_WB_Pipeline_Register
if (!rst_n) begin
id_wb_fsm_cs <= IDLE;
@ -632,9 +596,9 @@ module ibex_id_stage #(
end
end
///////////////////////////////////////
// ID-EX/WB FMS //
///////////////////////////////////////
//////////////////
// ID-EX/WB FMS //
//////////////////
always_comb begin
id_wb_fsm_ns = id_wb_fsm_cs;
@ -721,9 +685,9 @@ module ibex_id_stage #(
assign id_valid_o = ~halt_id & id_ready_o;
//----------------------------------------------------------------------------
// Assertions
//----------------------------------------------------------------------------
////////////////
// Assertions //
////////////////
`ifndef VERILATOR
// make sure that branch decision is valid when jumping
assert property (

View file

@ -244,9 +244,9 @@ module ibex_if_stage #(
assign if_ready = valid & id_ready_i;
assign if_valid_o = ~halt_if_i & if_ready;
//----------------------------------------------------------------------------
// Assertions
//----------------------------------------------------------------------------
////////////////
// Assertions //
////////////////
`ifndef VERILATOR
// there should never be a grant when there is no request
assert property (

View file

@ -96,7 +96,9 @@ module ibex_load_store_unit (
logic [31:0] rdata_q;
///////////////////////////////// BE generation ////////////////////////////////
///////////////////
// BE generation //
///////////////////
always_comb begin
case (data_type_ex_i) // Data type 00 Word, 01 Half word, 11,10 byte
2'b00: begin // Writing a word
@ -172,14 +174,9 @@ module ibex_load_store_unit (
end
end
////////////////////////////////////////////////////////////////////////
// ____ _ _____ _ _ //
// / ___|(_) __ _ _ __ | ____|_ _| |_ ___ _ __ ___(_) ___ _ __ //
// \___ \| |/ _` | '_ \ | _| \ \/ / __/ _ \ '_ \/ __| |/ _ \| '_ \ //
// ___) | | (_| | | | | | |___ > <| || __/ | | \__ \ | (_) | | | | //
// |____/|_|\__, |_| |_| |_____/_/\_\\__\___|_| |_|___/_|\___/|_| |_| //
// |___/ //
////////////////////////////////////////////////////////////////////////
////////////////////
// Sign extension //
////////////////////
logic [31:0] data_rdata_ext;
@ -448,9 +445,9 @@ module ibex_load_store_unit (
assign busy_o = (CS == WAIT_RVALID) | (data_req_o == 1'b1);
//////////////////////////////////////////////////////////////////////////////
// Assertions
//////////////////////////////////////////////////////////////////////////////
////////////////
// Assertions //
////////////////
`ifndef VERILATOR
// make sure there is no new request when the old one is not yet completely done
// i.e. it should not be possible to get a grant without an rvalid for the

View file

@ -60,16 +60,15 @@ module ibex_prefetch_buffer (
logic fifo_ready;
logic fifo_clear;
//////////////////////////////////////////////////////////////////////////////
// prefetch buffer status
//////////////////////////////////////////////////////////////////////////////
////////////////////////////
// Prefetch buffer status //
////////////////////////////
assign busy_o = (CS != IDLE) | instr_req_o;
//////////////////////////////////////////////////////////////////////////////
// fetch fifo
// consumes addresses and rdata
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////
// Fetch fifo - consumes addresses and data //
//////////////////////////////////////////////
ibex_fetch_fifo fifo_i (
.clk ( clk ),
@ -92,16 +91,15 @@ module ibex_prefetch_buffer (
);
//////////////////////////////////////////////////////////////////////////////
// fetch addr
//////////////////////////////////////////////////////////////////////////////
////////////////
// Fetch addr //
////////////////
assign fetch_addr = {instr_addr_q[31:2], 2'b00} + 32'd4;
assign fifo_clear = branch_i;
//////////////////////////////////////////////////////////////////////////////
// instruction fetch FSM
// deals with instruction memory / instruction cache
// Instruction fetch FSM -deals with instruction memory / instruction cache //
//////////////////////////////////////////////////////////////////////////////
always_comb begin
@ -208,9 +206,9 @@ module ibex_prefetch_buffer (
endcase
end
//////////////////////////////////////////////////////////////////////////////
// registers
//////////////////////////////////////////////////////////////////////////////
///////////////
// Registers //
///////////////
always_ff @(posedge clk, negedge rst_n) begin
if (!rst_n) begin

View file

@ -75,15 +75,15 @@ module ibex_register_file #(
logic clk_int;
//-----------------------------------------------------------------------------
//-- READ : Read address decoder RAD
//-----------------------------------------------------------------------------
//////////////////////////////////////
// READ: Read address decoder (RAD) //
//////////////////////////////////////
assign rdata_a_o = mem[raddr_a_int];
assign rdata_b_o = mem[raddr_b_int];
//-----------------------------------------------------------------------------
// WRITE : SAMPLE INPUT DATA
//---------------------------------------------------------------------------
///////////////////////////////
// WRITE: SAMPLE INPUT DATA //
///////////////////////////////
prim_clock_gating CG_WE_GLOBAL (
.clk_i ( clk ),
@ -103,9 +103,9 @@ module ibex_register_file #(
end
end
//-----------------------------------------------------------------------------
//-- WRITE : Write Address Decoder (WAD), combinatorial process
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////
// WRITE: Write Address Decoder (WAD), combinatorial process //
///////////////////////////////////////////////////////////////
always_comb begin : p_WADa
for (int i = 1; i < NUM_WORDS; i++) begin : p_WordItera
if (we_a_i && (waddr_a_int == i)) begin
@ -117,9 +117,9 @@ module ibex_register_file #(
end
//-----------------------------------------------------------------------------
//-- WRITE : Clock gating (if integrated clock-gating cells are available)
//-----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////
// WRITE: Clock gating (if integrated clock-gating cells are available) //
//////////////////////////////////////////////////////////////////////////
for (genvar x = 1; x < NUM_WORDS; x++) begin : gen_CG_CELL_WORD_ITER
prim_clock_gating CG_Inst (
.clk_i ( clk_int ),
@ -129,14 +129,14 @@ module ibex_register_file #(
);
end
//-----------------------------------------------------------------------------
//-- WRITE : Write operation
//-----------------------------------------------------------------------------
//-- Generate M = WORDS sequential processes, each of which describes one
//-- word of the memory. The processes are synchronized with the clocks
//-- ClocksxC(i), i = 0, 1, ..., M-1
//-- Use active low, i.e. transparent on low latches as storage elements
//-- Data is sampled on rising clock edge
////////////////////////////
// WRITE: Write operation //
////////////////////////////
// Generate M = WORDS sequential processes, each of which describes one
// word of the memory. The processes are synchronized with the clocks
// ClocksxC(i), i = 0, 1, ..., M-1
// Use active low, i.e. transparent on low latches as storage elements
// Data is sampled on rising clock edge
always_latch begin : latch_wdata
// Note: The assignment has to be done inside this process or Modelsim complains about it

View file

@ -23,14 +23,9 @@
*/
package ibex_defines;
////////////////////////////////////////////////
// ___ ____ _ //
// / _ \ _ __ / ___|___ __| | ___ ___ //
// | | | | '_ \| | / _ \ / _` |/ _ \/ __| //
// | |_| | |_) | |__| (_) | (_| | __/\__ \ //
// \___/| .__/ \____\___/ \__,_|\___||___/ //
// |_| //
////////////////////////////////////////////////
/////////////
// Opcodes //
/////////////
parameter OPCODE_SYSTEM = 7'h73;
parameter OPCODE_MISC_MEM = 7'h0f;
@ -59,15 +54,9 @@ parameter REGC_S1 = 2'b10;
parameter REGC_RD = 2'b01;
parameter REGC_ZERO = 2'b11;
//////////////////////////////////////////////////////////////////////////////
// _ _ _ _ ___ _ _ //
// / \ | | | | | | / _ \ _ __ ___ _ __ __ _| |_(_) ___ _ __ ___ //
// / _ \ | | | | | | | | | | '_ \ / _ \ '__/ _` | __| |/ _ \| '_ \/ __| //
// / ___ \| |__| |_| | | |_| | |_) | __/ | | (_| | |_| | (_) | | | \__ \ //
// /_/ \_\_____\___/ \___/| .__/ \___|_| \__,_|\__|_|\___/|_| |_|___/ //
// |_| //
//////////////////////////////////////////////////////////////////////////////
////////////////////
// ALU operations //
////////////////////
parameter ALU_OP_WIDTH = 6;
@ -162,14 +151,9 @@ parameter VEC_MODE16 = 2'b10;
parameter VEC_MODE8 = 2'b11;
/////////////////////////////////////////////////////////
// ____ ____ ____ _ _ //
// / ___/ ___| | _ \ ___ __ _(_)___| |_ ___ _ __ //
// | | \___ \ | |_) / _ \/ _` | / __| __/ _ \ '__| //
// | |___ ___) | | _ < __/ (_| | \__ \ || __/ | //
// \____|____/ |_| \_\___|\__, |_|___/\__\___|_| //
// |___/ //
/////////////////////////////////////////////////////////
//////////////////////////////////
// Control and status registers //
//////////////////////////////////
// CSR operations
parameter CSR_OP_NONE = 2'b00;
@ -204,14 +188,9 @@ typedef enum logic[3:0] {
XDEBUGVER_NONSTD = 4'd15 // debug not conforming to RISC-V debug spec
} Xdebugver_t;
///////////////////////////////////////////////
// ___ ____ ____ _ //
// |_ _| _ \ / ___|| |_ __ _ __ _ ___ //
// | || | | | \___ \| __/ _` |/ _` |/ _ \ //
// | || |_| | ___) | || (_| | (_| | __/ //
// |___|____/ |____/ \__\__,_|\__, |\___| //
// |___/ //
///////////////////////////////////////////////
//////////////
// ID stage //
//////////////
// forwarding operand mux
parameter SEL_REGFILE = 2'b00;
@ -269,14 +248,9 @@ parameter BMASK_B_IMM = 1'b1;
///////////////////////////////////////////////
// ___ _____ ____ _ //
// |_ _| ___| / ___|| |_ __ _ __ _ ___ //
// | || |_ \___ \| __/ _` |/ _` |/ _ \ //
// | || _| ___) | || (_| | (_| | __/ //
// |___|_| |____/ \__\__,_|\__, |\___| //
// |___/ //
///////////////////////////////////////////////
//////////////
// IF stage //
//////////////
// PC mux selector defines
parameter PC_BOOT = 3'b000;