<commit_before>package TurboRav

import Chisel._

import Common._
import Apb._

class Rom(implicit conf: TurboravConfig) extends Module {
  val io = new SlaveToApbIo()

  val s_idle :: s_setup :: s_access :: Nil = Enum(UInt(), 3)
  val state = Reg(init = s_idle)
  //Big ass statemachine, can't wait to refactor.
  when(state === s_idle)
  {
    when(io.sel) { state := s_setup }
  }
    .elsewhen(state === s_setup)
  {
    state := s_access
  }
    .elsewhen(state === s_access)
  {
    when(!io.ready)
    {
      state := s_access
    }
      .elsewhen(io.sel)
    {
      state := s_setup
    }
      .otherwise
    {
      state := s_idle
    }
  }
}<commit_msg>Finished with an untested inflexible rom apb module. Next step is writing a tester.<commit_after>package TurboRav

import Chisel._

import Common._
import Apb._

class Rom(implicit conf: TurboravConfig) extends Module {
  val io = new SlaveToApbIo()

  val s_idle :: s_setup :: s_access :: Nil = Enum(UInt(), 3)
  val state = Reg(init = s_idle)
  //Big ass statemachine, can't wait to refactor.
  when(state === s_idle)
  {
    when(io.sel) { state := s_setup }
  }
    .elsewhen(state === s_setup)
  {
    state := s_access
  }
    .elsewhen(state === s_access)
  {
    when(!io.ready)
    {
      state := s_access
    }
      .elsewhen(io.sel)
    {
      state := s_setup
    }
      .otherwise
    {
      state := s_idle
    }
  }

  val rom = Vec(
    Array(
      UInt(1, width=conf.apb_data_len),
      UInt(2, width=conf.apb_data_len),
      UInt(3, width=conf.apb_data_len),
      UInt(4, width=conf.apb_data_len)
    )
  )
  io.rdata  := rom(io.addr) & Fill(conf.apb_data_len, state === s_access)
  io.enable := state === s_access
  io.ready  := state === s_access
}
{'fraction_non_alphanumeric': 0.13287514318442153, 'fraction_numerical': 0.003436426116838488, 'mean_word_length': 2.4870259481037924, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3691421', 'n_tokens_mistral': 674, 'n_tokens_neox': 662, 'n_words': 148}