Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

privateNamespace changes BlackBox component name #1411

Open
apstrike opened this issue May 9, 2024 · 1 comment
Open

privateNamespace changes BlackBox component name #1411

apstrike opened this issue May 9, 2024 · 1 comment

Comments

@apstrike
Copy link

apstrike commented May 9, 2024

When using a BlackBox when privateNamespace=true in the SpinalConfig, a prefix is added to the blackboxed module on instantiation.

For example the following code:

class ExBB extends BlackBox {

  val io = new Bundle {
    val clk = in Bool()
    val dout = out Bool()
  }

  mapClockDomain(clock=io.clk)
}

class APExample extends Component {

  val io = new Bundle {
    val dout = out Bool()
  }

  val dut = new ExBB()

  io.dout := dut.io.dout

}

object TestConfig extends SpinalConfig(privateNamespace=true)

object Test {
  def main(args: Array[String]) {

    TestConfig.generateVerilog(new APExample())
  }
}

Produces the following Verilog file:

// Generator : SpinalHDL v1.10.1    git head : 2527c7c6b0fb0f95e5e1a5722a0be732b364ce43
// Component : APExample
// Git hash  : c48315fc0fad08e65876f209f9cbd59332330ae9

`timescale 1ns/1ps

module APExample (
  output wire          io_dout,
  input  wire          clk
);

  wire                dut_io_dout;

  APExample_ExBB dut (
    .io_clk  (clk        ), //i
    .io_dout (dut_io_dout)  //o
  );
  assign io_dout = dut_io_dout;

endmodule

I’d have assumed that blackboxed modules would keep their names as-is so that a user could share the module across multiple SpinalHDL projects.

@andreasWallner
Copy link
Collaborator

If you use privateNamespace then all components are prefixed to prevent any possible clashes when integrating into another codebase.
If you use globalPrefix instead then Blackboxes won't be prefixed:

object TestConfig extends SpinalConfig(globalPrefix="APExample")

Does that work for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants