E203 Hummingbird RISC-V processor code reading notes instruction prefetch module 1 (instruction micro-decoding) e203_ifu_minidec.v

tags: verilog  Digital IC front end  cpu design

This article records my learning journey of RISC-V Hummingbird E203 processor
This is the second source code file that I formally read the code study

For the study of the code, I combined my own understanding to make detailed comments on the interface of each module and the key internal signals.
The original is not easy, please protect the copyright, contact the author for reprinting, and please indicate the source and mark the original linkThank you~~
e203_ifu_minidec.v

/*                                                                      
 Copyright 2017 Silicon Integrated Microelectronics, Inc.                
                                                                         
 Licensed under the Apache License, Version 2.0 (the "License");         
 you may not use this file except in compliance with the License.        
 You may obtain a copy of the License at                                 
                                                                         
     http://www.apache.org/licenses/LICENSE-2.0                          
                                                                         
  Unless required by applicable law or agreed to in writing, software    
 distributed under the License is distributed on an "AS IS" BASIS,       
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and     
 limitations under the License.                                          
 */                                                                      
                                                                         
                                                                         
                                                                         
//=====================================================================
//--        _______   ___
//--       (   ____/ /__/
//--        \ \     __
//--     ____\ \   / /
//--    /_______\ /_/   MICROELECTRONICS
//--
//=====================================================================
// Designer   : Bob Hu
//
// Description:
//  The mini-decode module to decode the instruction in IFU 
//
// ====================================================================
// ========== Some notes of my own
// This module is a part of the exu_decode module that is instantiated, and the relevant information about the jump instruction is taken out, according to
// This information determines whether a PC jump is required when the current instruction is prefetched
// ==========
`include "e203_defines.v"

module e203_ifu_minidec(

  //////////////////////////////////////////////////////////////
  // The IR stage to Decoder
  input  [`E203_INSTR_SIZE-1:0] instr, //The instruction retrieved by the instruction logic is used as input and waiting for decoding
  
  //////////////////////////////////////////////////////////////
  // The Decoded Info-Bus


  output dec_rs1en, //Decoding to determine whether reg-source1 is valid, the original operands 1 and 2 of an instruction
  output dec_rs2en, //Decoding to determine whether reg-source2 is valid
  output [`E203_RFIDX_WIDTH-1:0] dec_rs1idx, //What is returned here is the address of the original operand register in the register list file
  output [`E203_RFIDX_WIDTH-1:0] dec_rs2idx, //That is to say, the registers in the cpu are individually addressed (that is, the internal bus of the cpu, independent of the system bus) into a file
                                             //The index here is the address of the original operand register on the internal bus of the cpu
  output dec_mulhsu, // mul-high-signed-unsigned rs1 is signed, rs2 is unsigned, the high 32bit of the multiplication result (64bit) is put into rd
  output dec_mul   , // mul rs1 is unsigned, rs2 is unsigned, (signed and unsigned are actually the same) the lower 32bit of the multiplication result (64bit) is put into rd
  output dec_div   , // div rs1 has a sign, rs2 has a sign
  output dec_rem   , // Take rs1 signed and rs2 signed numbers, take the remainder and send it to dr;
  output dec_divu  , // Unsigned take business and send dr
  output dec_remu  , // unsigned take the remainder and send dr

  output dec_rv32, //Indicates whether the current instruction is an rsic-v32-bit instruction or a 16-bit instruction
  output dec_bjp,  //Indicates whether the current instruction is a normal instruction or a branch instruction, indicating whether it belongs to a bxx instruction or a jxx instruction
  output dec_jal,  //Belongs to the jal instruction
  output dec_jalr, //Data jalr instruction
  output dec_bxx,  //Belong to BXX instructions, (BEQ, BNE and other conditional branch instructions)
  output [`E203_RFIDX_WIDTH-1:0] dec_jalr_rs1idx, //For the jalr instruction, it must first fetch the rs1 operand, and then add the immediate value to get the value +4 as the new pc. In order to fetch rs1, the instruction carries the address of rs1 (cpu internal index)
  output [`E203_XLEN-1:0] dec_bjp_imm             //For bxx instructions, if the conditions are met, the 12bit immediate value (signed) × 2 will be added to pc as the new pc; here is the immediate value of the decoded instruction 

  );

  e203_exu_decode u_e203_exu_decode(  // Regarding the exu_decode module, I have commented these interface signals in e203_exu_decode.v

  .i_instr(instr),
  .i_pc(`E203_PC_SIZE'b0),
  .i_prdt_taken(1'b0), 
  .i_muldiv_b2b(1'b0), 

  .i_misalgn (1'b0),
  .i_buserr  (1'b0),

  .dbg_mode  (1'b0),

  .dec_misalgn(),
  .dec_buserr(),
  .dec_ilegl(),

  .dec_rs1x0(),
  .dec_rs2x0(),
  .dec_rs1en(dec_rs1en), //  
  .dec_rs2en(dec_rs2en), // 
  .dec_rdwen(),
  .dec_rs1idx(dec_rs1idx),
  .dec_rs2idx(dec_rs2idx),
  .dec_rdidx(),
  .dec_info(),  
  .dec_imm(),
  .dec_pc(),

  
  .dec_mulhsu(dec_mulhsu),
  .dec_mul   (dec_mul   ),
  .dec_div   (dec_div   ),
  .dec_rem   (dec_rem   ),
  .dec_divu  (dec_divu  ),
  .dec_remu  (dec_remu  ),

  .dec_rv32(dec_rv32),
  .dec_bjp (dec_bjp ),
  .dec_jal (dec_jal ),
  .dec_jalr(dec_jalr),
  .dec_bxx (dec_bxx ),

  .dec_jalr_rs1idx(dec_jalr_rs1idx),
  .dec_bjp_imm    (dec_bjp_imm    )  
  );


endmodule

Intelligent Recommendation

Hummingbird E203 open source RISC-V (DDR200T pit)

When I run the gpio program, I have used the .mcs in hbird to burn into the ddr200t development board through vivado, but my core in the ide: still only N205, no e203 ---------- --------ide does not a...

RISC-V vector extension instruction (1)

Overview During the execution of the computer instructions, it is mainly divided into three steps. For scalar instructions, each time the same instructions are executed, the above processes will be re...

RISC-V instruction Learning Notes (based on CH32V103)

Articles directory RISC-V instruction Learning Notes (based on CH32V103) 1. Classification of instruction structure Second, register function 3. Load storage instructions Fourth, calculation of calcul...

RISC-V instruction format

RISC-V purpose - simple RISC-V Instruction Set Architecture (ISA) as a new generation of open source instruction set architecture, is a new, simple, clear, open source instruction set architecture. RI...

RISC-V instruction set

RISC-V instruction set R TYPE ADD SUB SLL SLT SLTU XOR SRL SRA OR AND I TYPE ADDI SLTI SLTIU XORI ORI ANDI SLLI SRLI SRAI I_L TYPE LB This command reads a byte (byte) from a valid address, and is writ...

More Recommendation

RISC-V instruction and register

RISC-V address space Foreword 1. RISC-V address space 2. RV32i general register and function call agreement 3. RV32i instruction format Summarize Foreword In the process of debugging and project devel...

[Hummingbird E203 kernel analysis] CHAP.3 custom instruction and collaborator design

[Hummingbird E203 kernel analysis] CHAP.3 custom instruction and collaborator design 1. Concept 2. How to call the NICE processor independent from the "main nuclear process"? 3. How to custo...

Hummingbird E203 open source RISC-V development board: Hummingbird FPGA development board and JTAG debugger introduction

Original source: With the first domestic RISC-V Chinese book "Teach you to design CPU - RISC-V processor" officially listed, more and more enthusiasts began to use the open source Hummingbir...

Open source RISC-V processor (Hummingbird E203) Study (5) A100T-FPGA transplants Hibirdvv2, realize CentOS downward test device USB identification and program compilation, and perform C language simulation

1. Brief description Recently, I bought a piece suitable for verification FPGA board cards. The board and card interface and peripherals are relatively rich, which is very suitable for running some sm...

RISC-V instruction definition function

Definition function File in CRU_TEST.H "|" Means: or operation ## addr ##: Represents the variable ADDR value to the li instruction (li x13, CRU_BASE | ## Addr ##) call function In Cru_freq_...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top