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

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [rtl/] [core/] [neorv32_cpu_alu.vhd] - Diff between revs 65 and 66

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 65 Rev 66
Line 42... Line 42...
use neorv32.neorv32_package.all;
use neorv32.neorv32_package.all;
 
 
entity neorv32_cpu_alu is
entity neorv32_cpu_alu is
  generic (
  generic (
    -- RISC-V CPU Extensions --
    -- RISC-V CPU Extensions --
 
    CPU_EXTENSION_RISCV_B     : boolean; -- implement bit-manipulation extension?
    CPU_EXTENSION_RISCV_M     : boolean; -- implement mul/div extension?
    CPU_EXTENSION_RISCV_M     : boolean; -- implement mul/div extension?
    CPU_EXTENSION_RISCV_Zbb   : boolean; -- implement basic bit-manipulation sub-extension?
 
    CPU_EXTENSION_RISCV_Zmmul : boolean; -- implement multiply-only M sub-extension?
    CPU_EXTENSION_RISCV_Zmmul : boolean; -- implement multiply-only M sub-extension?
    CPU_EXTENSION_RISCV_Zfinx : boolean; -- implement 32-bit floating-point extension (using INT reg!)
    CPU_EXTENSION_RISCV_Zfinx : boolean; -- implement 32-bit floating-point extension (using INT reg!)
    -- Extension Options --
    -- Extension Options --
    FAST_MUL_EN               : boolean; -- use DSPs for M extension's multiplier
    FAST_MUL_EN               : boolean; -- use DSPs for M extension's multiplier
    FAST_SHIFT_EN             : boolean  -- use barrel shifter for shift operations
    FAST_SHIFT_EN             : boolean  -- use barrel shifter for shift operations
Line 253... Line 253...
    rstn_i  => rstn_i,          -- global reset, low-active, async
    rstn_i  => rstn_i,          -- global reset, low-active, async
    ctrl_i  => ctrl_i,          -- main control bus
    ctrl_i  => ctrl_i,          -- main control bus
    start_i => cp_start(0),     -- trigger operation
    start_i => cp_start(0),     -- trigger operation
    -- data input --
    -- data input --
    rs1_i   => rs1_i,           -- rf source 1
    rs1_i   => rs1_i,           -- rf source 1
    rs2_i   => rs2_i,           -- rf source 2
    shamt_i => opb(index_size_f(data_width_c)-1 downto 0), -- shift amount
    imm_i   => imm_i,           -- immediate
 
    -- result and status --
    -- result and status --
    res_o   => cp_result(0),    -- operation result
    res_o   => cp_result(0),    -- operation result
    valid_o => cp_valid(0)      -- data output valid
    valid_o => cp_valid(0)      -- data output valid
  );
  );
 
 
Line 292... Line 291...
    cp_result(1) <= (others => '0');
    cp_result(1) <= (others => '0');
    cp_valid(1)  <= cp_start(1); -- to make sure CPU does not get stalled if there is an accidental access
    cp_valid(1)  <= cp_start(1); -- to make sure CPU does not get stalled if there is an accidental access
  end generate;
  end generate;
 
 
 
 
  -- Co-Processor 2: Bit-Manipulation Unit ('B'/'Zbb' Extension) ----------------------------
  -- Co-Processor 2: Bit-Manipulation Unit ('B' Extension) ----------------------------------
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  neorv32_cpu_cp_bitmanip_inst_true:
  neorv32_cpu_cp_bitmanip_inst_true:
  if (CPU_EXTENSION_RISCV_Zbb = true) generate
  if (CPU_EXTENSION_RISCV_B = true) generate
    neorv32_cpu_cp_bitmanip_inst: neorv32_cpu_cp_bitmanip
    neorv32_cpu_cp_bitmanip_inst: neorv32_cpu_cp_bitmanip
    generic map (
    generic map (
      FAST_SHIFT_EN => FAST_SHIFT_EN -- use barrel shifter for shift operations
      FAST_SHIFT_EN => FAST_SHIFT_EN -- use barrel shifter for shift operations
    )
    )
    port map (
    port map (
Line 310... Line 309...
      start_i  => cp_start(2),  -- trigger operation
      start_i  => cp_start(2),  -- trigger operation
      -- data input --
      -- data input --
      cmp_i    => cmp,          -- comparator status
      cmp_i    => cmp,          -- comparator status
      rs1_i    => rs1_i,        -- rf source 1
      rs1_i    => rs1_i,        -- rf source 1
      rs2_i    => rs2_i,        -- rf source 2
      rs2_i    => rs2_i,        -- rf source 2
 
      shamt_i => opb(index_size_f(data_width_c)-1 downto 0), -- shift amount
      -- result and status --
      -- result and status --
      res_o    => cp_result(2), -- operation result
      res_o    => cp_result(2), -- operation result
      valid_o  => cp_valid(2)   -- data output valid
      valid_o  => cp_valid(2)   -- data output valid
    );
    );
  end generate;
  end generate;
 
 
  neorv32_cpu_cp_bitmanip_inst_false:
  neorv32_cpu_cp_bitmanip_inst_false:
  if (CPU_EXTENSION_RISCV_Zbb = false) generate
  if (CPU_EXTENSION_RISCV_B = false) generate
    cp_result(2) <= (others => '0');
    cp_result(2) <= (others => '0');
    cp_valid(2)  <= cp_start(2); -- to make sure CPU does not get stalled if there is an accidental access
    cp_valid(2)  <= cp_start(2); -- to make sure CPU does not get stalled if there is an accidental access
  end generate;
  end generate;
 
 
 
 

powered by: WebSVN 2.1.0

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