Skip to content

Commit

Permalink
[fi] OTFIIbex: Use OTFITest
Browse files Browse the repository at this point in the history
  • Loading branch information
aewag committed Jun 4, 2024
1 parent 6ffd978 commit 220db37
Showing 1 changed file with 29 additions and 230 deletions.
259 changes: 29 additions & 230 deletions target/communication/fi_ibex_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,239 +5,38 @@
Communication with OpenTitan happens over the uJSON command interface.
"""
import json
import time
from typing import Optional


from target.communication.otfi import OTFI
from target.communication.otfi_test import OTFITest


class OTFIIbex(OTFI):
TESTS = [
OTFITest("char_unrolled_reg_op_loop"),
OTFITest("char_unrolled_mem_op_loop"),
OTFITest("char_reg_op_loop"),
OTFITest("char_mem_op_loop"),
OTFITest("char_flash_read"),
OTFITest("char_flash_write"),
OTFITest("char_sram_read"),
OTFITest("char_sram_write_static_unrolled"),
OTFITest("char_sram_write_read"),
OTFITest("char_sram_write"),
OTFITest("char_sram_static"),
OTFITest("char_conditional_branch_beq", "CharCondBranchBeq"),
OTFITest("char_conditional_branch_bne", "CharCondBranchBne"),
OTFITest("char_conditional_branch_bge", "CharCondBranchBge"),
OTFITest("char_conditional_branch_bgeu", "CharCondBranchBgeu"),
OTFITest("char_conditional_branch_blt", "CharCondBranchBlt"),
OTFITest("char_conditional_branch_bltu", "CharCondBranchBltu"),
OTFITest("char_unconditional_branch", "CharUncondBranch"),
OTFITest("char_unconditional_branch_nop", "CharUncondBranchNop"),
OTFITest("char_register_file"),
OTFITest("char_register_file_read"),
OTFITest("char_csr_write"),
OTFITest("char_csr_read"),
OTFITest("address_translation"),
OTFITest("address_translation_config", "AddressTranslationCfg"),
]

def __init__(self, target) -> None:
super().__init__(target, "Ibex")

def ibex_char_unrolled_reg_op_loop(self) -> None:
""" Starts the ibex.char.unrolled_reg_op_loop test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharUnrolledRegOpLoop command.
time.sleep(0.01)
self.target.write(json.dumps("CharUnrolledRegOpLoop").encode("ascii"))

def ibex_char_unrolled_mem_op_loop(self) -> None:
""" Starts the ibex.char.unrolled_mem_op_loop test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharUnrolledMemOpLoop command.
time.sleep(0.01)
self.target.write(json.dumps("CharUnrolledMemOpLoop").encode("ascii"))

def ibex_char_reg_op_loop(self) -> None:
""" Starts the ibex.char.reg_op_loop test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharRegOpLoop command.
time.sleep(0.01)
self.target.write(json.dumps("CharRegOpLoop").encode("ascii"))

def ibex_char_mem_op_loop(self) -> None:
""" Starts the ibex.char.mem_op_loop test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharMemOpLoop command.
time.sleep(0.01)
self.target.write(json.dumps("CharMemOpLoop").encode("ascii"))

def ibex_char_flash_read(self) -> None:
""" Starts the ibex.char.flash_read test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharFlashRead command.
time.sleep(0.01)
self.target.write(json.dumps("CharFlashRead").encode("ascii"))

def ibex_char_flash_write(self) -> None:
""" Starts the ibex.char.flash_write test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharFlashWrite command.
time.sleep(0.01)
self.target.write(json.dumps("CharFlashWrite").encode("ascii"))

def ibex_char_sram_read(self) -> None:
""" Starts the ibex.char.sram_read test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharSramRead command.
time.sleep(0.01)
self.target.write(json.dumps("CharSramRead").encode("ascii"))

def ibex_char_sram_write_static_unrolled(self) -> None:
""" Starts the ibex.char.sram_write_static_unrolled test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharSramWriteStaticUnrolled command.
time.sleep(0.01)
self.target.write(json.dumps("CharSramWriteStaticUnrolled").encode("ascii"))

def ibex_char_sram_write_read(self) -> None:
""" Starts the ibex.char.sram_write_read test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharSramWriteRead command.
time.sleep(0.01)
self.target.write(json.dumps("CharSramWriteRead").encode("ascii"))

def ibex_char_sram_write(self) -> None:
""" Starts the ibex.char.sram_write test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharSramWrite command.
time.sleep(0.01)
self.target.write(json.dumps("CharSramWrite").encode("ascii"))

def ibex_char_sram_static(self) -> None:
""" Starts the ibex.char.sram_static test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharSramWrite command.
time.sleep(0.01)
self.target.write(json.dumps("CharSramStatic").encode("ascii"))

def ibex_char_conditional_branch_beq(self) -> None:
""" Starts the ibex.char.conditional_branch_beq test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharCondBranchBeq command.
time.sleep(0.01)
self.target.write(json.dumps("CharCondBranchBeq").encode("ascii"))

def ibex_char_conditional_branch_bne(self) -> None:
""" Starts the ibex.char.conditional_branch_bne test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharCondBranchBne command.
time.sleep(0.01)
self.target.write(json.dumps("CharCondBranchBne").encode("ascii"))

def ibex_char_conditional_branch_bge(self) -> None:
""" Starts the ibex.char.conditional_branch_bge test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharCondBranchBge command.
time.sleep(0.01)
self.target.write(json.dumps("CharCondBranchBge").encode("ascii"))

def ibex_char_conditional_branch_bgeu(self) -> None:
""" Starts the ibex.char.conditional_branch_bgeu test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharCondBranchBgeu command.
time.sleep(0.01)
self.target.write(json.dumps("CharCondBranchBgeu").encode("ascii"))

def ibex_char_conditional_branch_blt(self) -> None:
""" Starts the ibex.char.conditional_branch_blt test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharCondBranchBglt command.
time.sleep(0.01)
self.target.write(json.dumps("CharCondBranchBlt").encode("ascii"))

def ibex_char_conditional_branch_bltu(self) -> None:
""" Starts the ibex.char.conditional_branch_bltu test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharCondBranchBgltu command.
time.sleep(0.01)
self.target.write(json.dumps("CharCondBranchBltu").encode("ascii"))

def ibex_char_unconditional_branch(self) -> None:
""" Starts the ibex.char.unconditional_branch test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharUncondBranch command.
time.sleep(0.01)
self.target.write(json.dumps("CharUncondBranch").encode("ascii"))

def ibex_char_unconditional_branch_nop(self) -> None:
""" Starts the ibex.char.unconditional_branch_nop test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharUncondBranchNop command.
time.sleep(0.01)
self.target.write(json.dumps("CharUncondBranchNop").encode("ascii"))

def ibex_char_register_file(self) -> None:
""" Starts the ibex.char.register_file test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharRegisterFile command.
time.sleep(0.01)
self.target.write(json.dumps("CharRegisterFile").encode("ascii"))

def ibex_char_register_file_read(self) -> None:
""" Starts the ibex.char.register_file_read test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharRegisterFileRead command.
time.sleep(0.01)
self.target.write(json.dumps("CharRegisterFileRead").encode("ascii"))

def ibex_char_csr_write(self) -> None:
""" Starts the ibex.fi.char.csr_write test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharCsrWrite command.
time.sleep(0.01)
self.target.write(json.dumps("CharCsrWrite").encode("ascii"))

def ibex_char_csr_read(self) -> None:
""" Starts the ibex.fi.char.csr_read test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# CharCsrRead command.
time.sleep(0.01)
self.target.write(json.dumps("CharCsrRead").encode("ascii"))

def ibex_address_translation_config(self) -> None:
""" Starts the ibex.fi.address_translation_config test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# AddressTranslationCfg command.
time.sleep(0.01)
self.target.write(json.dumps("AddressTranslationCfg").encode("ascii"))

def ibex_address_translation(self) -> None:
""" Starts the ibex.fi.address_translation test.
"""
# IbexFi command.
self._ujson_fi_cmd()
# AddressTranslation command.
time.sleep(0.01)
self.target.write(json.dumps("AddressTranslation").encode("ascii"))

0 comments on commit 220db37

Please sign in to comment.