<commit_before>package TurboRav

import Chisel._

class FpgaRamTest(c: FpgaRam) extends JUnitTester(c) {
  def write_and_then_read_back(addr: Long, word: Long, word_length_bytes: Int) = {
    println("write_and_then_read_back(%x, %x, %x)".format(addr, word, word_length_bytes))

    //TODO: Check that we aren't modifying any memory contents that we
    //shouldn't be.

    // *addr = value;
    // expect value == *addr;

    val byte_en = word_length_bytes match {
      case 1 => 1
      case 2 => 2
      case 4 => 0
    }
    val mask = word_length_bytes match {
      case 1 => 0xFFL
      case 2 => 0xFFFFL
      case 4 => 0xFFFFFFFFL
    }

    poke(c.io.addr, addr)
    poke(c.io.word_w, word)
    poke(c.io.wen, 1)
    poke(c.io.byte_en, byte_en)
    poke(c.io.ren, 0)
<commit_msg>FpgaRamtest: More readable log output<commit_after>package TurboRav

import Chisel._

class FpgaRamTest(c: FpgaRam) extends JUnitTester(c) {
  def write_and_then_read_back(addr: Long, word: Long, word_length_bytes: Int): Unit = {
    println("write_and_then_read_back(addr: %x, word: %x, word_length_bytes: %x)".format(
      addr, word, word_length_bytes
      )
    )

    //TODO: Check that we aren't modifying any memory contents that we
    //shouldn't be.

    // *addr = value;
    // expect value == *addr;

    val byte_en = word_length_bytes match {
      case 1 => 1
      case 2 => 2
      case 4 => 0
    }
    val mask = word_length_bytes match {
      case 1 => 0xFFL
      case 2 => 0xFFFFL
      case 4 => 0xFFFFFFFFL
    }

    poke(c.io.addr, addr)
    poke(c.io.word_w, word)
    poke(c.io.wen, 1)
    poke(c.io.byte_en, byte_en)
    poke(c.io.ren, 0)

{'fraction_non_alphanumeric': 0.11959134615384616, 'fraction_numerical': 0.016826923076923076, 'mean_word_length': 2.6353711790393013, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '916298', 'n_tokens_mistral': 683, 'n_tokens_neox': 628, 'n_words': 159}