Line 153... |
Line 153... |
impure function init_wbmem(init : application_init_image_t) return ext_mem_a_ram_t is
|
impure function init_wbmem(init : application_init_image_t) return ext_mem_a_ram_t is
|
variable mem_v : ext_mem_a_ram_t;
|
variable mem_v : ext_mem_a_ram_t;
|
begin
|
begin
|
mem_v := (others => (others => '0'));
|
mem_v := (others => (others => '0'));
|
for i in 0 to init'length-1 loop -- init only in range of source data array
|
for i in 0 to init'length-1 loop -- init only in range of source data array
|
if (xbus_big_endian_c = true) then
|
if (xbus_big_endian_c = false) then
|
mem_v(i) := init(i);
|
mem_v(i) := init(i);
|
else
|
else
|
mem_v(i) := bswap32_f(init(i));
|
mem_v(i) := bswap32_f(init(i));
|
end if;
|
end if;
|
end loop; -- i
|
end loop; -- i
|
Line 195... |
Line 195... |
HW_THREAD_ID => 0, -- hardware thread id (hartid) (32-bit)
|
HW_THREAD_ID => 0, -- hardware thread id (hartid) (32-bit)
|
-- On-Chip Debugger (OCD) --
|
-- On-Chip Debugger (OCD) --
|
ON_CHIP_DEBUGGER_EN => true, -- implement on-chip debugger
|
ON_CHIP_DEBUGGER_EN => true, -- implement on-chip debugger
|
-- RISC-V CPU Extensions --
|
-- RISC-V CPU Extensions --
|
CPU_EXTENSION_RISCV_A => true, -- implement atomic extension?
|
CPU_EXTENSION_RISCV_A => true, -- implement atomic extension?
|
CPU_EXTENSION_RISCV_B => true, -- implement bit manipulation extensions?
|
|
CPU_EXTENSION_RISCV_C => true, -- implement compressed extension?
|
CPU_EXTENSION_RISCV_C => true, -- implement compressed extension?
|
CPU_EXTENSION_RISCV_E => false, -- implement embedded RF extension?
|
CPU_EXTENSION_RISCV_E => false, -- implement embedded RF extension?
|
CPU_EXTENSION_RISCV_M => true, -- implement muld/div extension?
|
CPU_EXTENSION_RISCV_M => true, -- implement muld/div extension?
|
CPU_EXTENSION_RISCV_U => true, -- implement user mode extension?
|
CPU_EXTENSION_RISCV_U => true, -- implement user mode extension?
|
CPU_EXTENSION_RISCV_Zfinx => true, -- implement 32-bit floating-point extension (using INT reg!)
|
CPU_EXTENSION_RISCV_Zfinx => true, -- implement 32-bit floating-point extension (using INT reg!)
|
Line 213... |
Line 212... |
-- Physical Memory Protection (PMP) --
|
-- Physical Memory Protection (PMP) --
|
PMP_NUM_REGIONS => 5, -- number of regions (0..64)
|
PMP_NUM_REGIONS => 5, -- number of regions (0..64)
|
PMP_MIN_GRANULARITY => 64*1024, -- minimal region granularity in bytes, has to be a power of 2, min 8 bytes
|
PMP_MIN_GRANULARITY => 64*1024, -- minimal region granularity in bytes, has to be a power of 2, min 8 bytes
|
-- Hardware Performance Monitors (HPM) --
|
-- Hardware Performance Monitors (HPM) --
|
HPM_NUM_CNTS => 12, -- number of implemented HPM counters (0..29)
|
HPM_NUM_CNTS => 12, -- number of implemented HPM counters (0..29)
|
HPM_CNT_WIDTH => 40, -- total size of HPM counters (1..64)
|
HPM_CNT_WIDTH => 40, -- total size of HPM counters (0..64)
|
-- Internal Instruction memory --
|
-- Internal Instruction memory --
|
MEM_INT_IMEM_EN => int_imem_c , -- implement processor-internal instruction memory
|
MEM_INT_IMEM_EN => int_imem_c , -- implement processor-internal instruction memory
|
MEM_INT_IMEM_SIZE => imem_size_c, -- size of processor-internal instruction memory in bytes
|
MEM_INT_IMEM_SIZE => imem_size_c, -- size of processor-internal instruction memory in bytes
|
MEM_INT_IMEM_ROM => false, -- implement processor-internal instruction memory as ROM
|
MEM_INT_IMEM_ROM => false, -- implement processor-internal instruction memory as ROM
|
-- Internal Data memory --
|
-- Internal Data memory --
|
Line 236... |
Line 235... |
IO_MTIME_EN => true, -- implement machine system timer (MTIME)?
|
IO_MTIME_EN => true, -- implement machine system timer (MTIME)?
|
IO_UART0_EN => true, -- implement primary universal asynchronous receiver/transmitter (UART0)?
|
IO_UART0_EN => true, -- implement primary universal asynchronous receiver/transmitter (UART0)?
|
IO_UART1_EN => true, -- implement secondary universal asynchronous receiver/transmitter (UART1)?
|
IO_UART1_EN => true, -- implement secondary universal asynchronous receiver/transmitter (UART1)?
|
IO_SPI_EN => true, -- implement serial peripheral interface (SPI)?
|
IO_SPI_EN => true, -- implement serial peripheral interface (SPI)?
|
IO_TWI_EN => true, -- implement two-wire interface (TWI)?
|
IO_TWI_EN => true, -- implement two-wire interface (TWI)?
|
IO_PWM_EN => true, -- implement pulse-width modulation unit (PWM)?
|
IO_PWM_NUM_CH => 30, -- number of PWM channels to implement (0..60); 0 = disabled
|
IO_WDT_EN => true, -- implement watch dog timer (WDT)?
|
IO_WDT_EN => true, -- implement watch dog timer (WDT)?
|
IO_TRNG_EN => false, -- trng cannot be simulated
|
IO_TRNG_EN => false, -- trng cannot be simulated
|
IO_CFS_EN => true, -- implement custom functions subsystem (CFS)?
|
IO_CFS_EN => true, -- implement custom functions subsystem (CFS)?
|
IO_CFS_CONFIG => (others => '0'), -- custom CFS configuration generic
|
IO_CFS_CONFIG => (others => '0'), -- custom CFS configuration generic
|
IO_CFS_IN_SIZE => 32, -- size of CFS input conduit in bits
|
IO_CFS_IN_SIZE => 32, -- size of CFS input conduit in bits
|
Line 292... |
Line 291... |
spi_sdi_i => spi_data, -- controller data in, peripheral data out
|
spi_sdi_i => spi_data, -- controller data in, peripheral data out
|
spi_csn_o => open, -- SPI CS
|
spi_csn_o => open, -- SPI CS
|
-- TWI (available if IO_TWI_EN = true) --
|
-- TWI (available if IO_TWI_EN = true) --
|
twi_sda_io => twi_sda, -- twi serial data line
|
twi_sda_io => twi_sda, -- twi serial data line
|
twi_scl_io => twi_scl, -- twi serial clock line
|
twi_scl_io => twi_scl, -- twi serial clock line
|
-- PWM (available if IO_PWM_EN = true) --
|
-- PWM (available if IO_PWM_NUM_CH > 0) --
|
pwm_o => open, -- pwm channels
|
pwm_o => open, -- pwm channels
|
-- Custom Functions Subsystem IO --
|
-- Custom Functions Subsystem IO --
|
cfs_in_i => (others => '0'), -- custom CFS inputs
|
cfs_in_i => (others => '0'), -- custom CFS inputs
|
cfs_out_o => open, -- custom CFS outputs
|
cfs_out_o => open, -- custom CFS outputs
|
-- NCO output (available if IO_NCO_EN = true) --
|
-- NCO output (available if IO_NCO_EN = true) --
|
Line 601... |
Line 600... |
irq_trigger: process(clk_gen)
|
irq_trigger: process(clk_gen)
|
begin
|
begin
|
if rising_edge(clk_gen) then
|
if rising_edge(clk_gen) then
|
-- bus interface --
|
-- bus interface --
|
wb_irq.rdata <= (others => '0');
|
wb_irq.rdata <= (others => '0');
|
wb_irq.ack <= wb_irq.cyc and wb_irq.stb and wb_irq.we and and_all_f(wb_irq.sel);
|
wb_irq.ack <= wb_irq.cyc and wb_irq.stb and wb_irq.we and and_reduce_f(wb_irq.sel);
|
wb_irq.err <= '0';
|
wb_irq.err <= '0';
|
-- trigger IRQ using CSR.MIE bit layout --
|
-- trigger IRQ using CSR.MIE bit layout --
|
nmi_ring <= '0';
|
nmi_ring <= '0';
|
msi_ring <= '0';
|
msi_ring <= '0';
|
mei_ring <= '0';
|
mei_ring <= '0';
|
soc_firq_ring <= (others => '0');
|
soc_firq_ring <= (others => '0');
|
if ((wb_irq.cyc and wb_irq.stb and wb_irq.we and and_all_f(wb_irq.sel)) = '1') then
|
if ((wb_irq.cyc and wb_irq.stb and wb_irq.we and and_reduce_f(wb_irq.sel)) = '1') then
|
nmi_ring <= wb_irq.wdata(00); -- non-maskable interrupt
|
nmi_ring <= wb_irq.wdata(00); -- non-maskable interrupt
|
msi_ring <= wb_irq.wdata(03); -- machine software interrupt
|
msi_ring <= wb_irq.wdata(03); -- machine software interrupt
|
mei_ring <= wb_irq.wdata(11); -- machine software interrupt
|
mei_ring <= wb_irq.wdata(11); -- machine software interrupt
|
--
|
--
|
soc_firq_ring(0) <= wb_irq.wdata(26); -- fast interrupt SoC channel 0 (-> FIRQ channel 10)
|
soc_firq_ring(0) <= wb_irq.wdata(26); -- fast interrupt SoC channel 0 (-> FIRQ channel 10)
|