This is the top level module, that imports -> import_chisel_mod which imports -> ToImport. This collection of notebooks and .sc files are meant to demonstrate how to do chisel development in a notebook environment, particularly how to import the modules implemented in one notebook to another.

Compiling /Users/jasonvranek/code/notebooks/chisel-nbdev/nbdev/ModB.sc[info] [0.002] Elaborating design...
[info] [1.576] Done elaborating.
file loaded in 0.046689542 seconds, 7 symbols, 3 statements
test Add Success: 0 tests passed in 4 cycles in 0.069917 seconds 57.21 Hz
[info] [0.001] Elaborating design...
[info] [0.220] Done elaborating.
file loaded in 0.006307083 seconds, 13 symbols, 7 statements
test ComposedModule Success: 0 tests passed in 4 cycles in 0.011610 seconds 344.54 Hz
import $file.$           , ModB._
import $file.$                
import chisel3.{Input => Input}

import chisel3._

import chisel3.util._

import chisel3.tester._

import chisel3.iotesters.{ChiselFlatSpec, Driver, PeekPokeTester}

import chisel3.tester.RawTester.test

Lets use this imported module to build a module in this notebook:

defined class DoubleComposedMod
test(new DoubleComposedMod) { c => 
    c.io.in.poke(1.U)    
    c.clock.step(1)    
    c.io.out.expect(7.U)
    
    c.io.in.poke(5.U)    
    c.clock.step(1)    
    c.io.out.expect(11.U)
}
[info] [0.001] Elaborating design...
[info] [0.158] Done elaborating.
file loaded in 0.005069792 seconds, 6 symbols, 3 statements
test DoubleComposedMod Success: 0 tests passed in 4 cycles in 0.030426 seconds 131.47 Hz