Skip to content

Commit

Permalink
Fix interrupts
Browse files Browse the repository at this point in the history
  • Loading branch information
piotro888 committed Nov 19, 2024
1 parent e85081a commit 29834ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions coreblocks/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from transactron.utils.dependencies import DependencyContext
from coreblocks.priv.traps.instr_counter import CoreInstructionCounter
from coreblocks.func_blocks.interface.func_blocks_unifier import FuncBlocksUnifier
from coreblocks.priv.traps.interrupt_controller import InternalInterruptController
from coreblocks.priv.traps.interrupt_controller import ISA_RESERVED_INTERRUPTS, InternalInterruptController
from transactron.core import Transaction, TModule
from transactron.lib import ConnectTrans, MethodProduct
from coreblocks.interface.layouts import *
Expand Down Expand Up @@ -42,7 +42,7 @@ def __init__(self, *, gen_params: GenParams):
{
"wb_instr": Out(WishboneSignature(gen_params.wb_params)),
"wb_data": Out(WishboneSignature(gen_params.wb_params)),
"interrupts": In(gen_params.isa.xlen),
"interrupts": In(ISA_RESERVED_INTERRUPTS + gen_params.interrupt_custom_count),
}
)

Expand Down
11 changes: 7 additions & 4 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from coreblocks.params.instr import *
from coreblocks.params.configurations import *
from coreblocks.peripherals.wishbone import WishboneMemorySlave
from coreblocks.priv.traps.interrupt_controller import ISA_RESERVED_INTERRUPTS

import random
import subprocess
Expand Down Expand Up @@ -39,10 +40,12 @@ def elaborate(self, platform):

self.core = Core(gen_params=self.gen_params)

self.interrupt_level = Signal()
self.interrupt_edge = Signal()

m.d.comb += self.core.interrupt_controller.custom_report.eq(Cat(self.interrupt_edge, self.interrupt_level))
if self.gen_params.interrupt_custom_count == 2:
self.interrupt_level = Signal()
self.interrupt_edge = Signal()
m.d.comb += self.core.interrupts.eq(
Cat(self.interrupt_edge, self.interrupt_level) << ISA_RESERVED_INTERRUPTS
)

m.submodules.wb_mem_slave = self.wb_mem_slave
m.submodules.wb_mem_slave_data = self.wb_mem_slave_data
Expand Down

0 comments on commit 29834ae

Please sign in to comment.