DFiantHDL / DFHDL

DFiant HDL (DFHDL): A Dataflow Hardware Descripition Language
https://dfianthdl.github.io/
GNU Lesser General Public License v3.0
78 stars 8 forks source link

Clock and reset signals of submodules declared but not assigned in RTDesign #147

Closed MartinC45 closed 4 months ago

MartinC45 commented 5 months ago

Example

val clkCfg1 = ClkCfg(ClkCfg.Edge.Rising)
val rstCfg1 = RstCfg(RstCfg.Mode.Sync, RstCfg.Active.High)
val rtcfg = RTDomainCfg(clkCfg1, rstCfg1)

class INV() extends RTDesign:
    val a = Bit <> IN
    val c = Bit <> VAR.REG init 0
    val b = Bit <> OUT
    c.din := a
    b := !a && c

class ClockRstConnection() extends RTDesign(rtcfg):
    val a = Bit <> IN
    val b = Bit <> OUT

    val inv0 = new INV()

    inv0.a <> a
    inv0.b <> b

@main def main = 
   ClockRstConnection().compile

Output

`default_nettype none
`timescale 1ns/1ps
`include "ClockRstConnection_defs.sv"

module ClockRstConnection(
  input wire logic clk,
  input wire logic rst,
  input wire logic a,
  output logic     b
);
  logic inv0_clk; // declared but never assigned
  logic inv0_rst;
  logic inv0_a;
  logic inv0_b;
  INV inv0(
    .clk /*<--*/ (inv0_clk),
    .rst /*<--*/ (inv0_rst),
    .a   /*<--*/ (inv0_a),
    .b   /*-->*/ (inv0_b)
  );
  assign inv0_a = a;
  assign b      = inv0_b;
endmodule
soronpo commented 4 months ago

@MartinC45 apologies for the delay in fixing this.

MartinC45 commented 4 months ago

No problem at all, thanks for the fix. With this, I could get a first slightly larger design involving multiple modules working, without any VHDL edits required to run simulation.