Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

UHDM_VERILATOR support for Mailbox and Custom class constructor #434

Open
EngRaff92 opened this issue Aug 29, 2021 · 1 comment
Open

UHDM_VERILATOR support for Mailbox and Custom class constructor #434

EngRaff92 opened this issue Aug 29, 2021 · 1 comment

Comments

@EngRaff92
Copy link

EngRaff92 commented Aug 29, 2021

Hello all,

As mentioned probably in a previous conversation I tried this code:

// timescale 1ns/1ns

class driver;
  mailbox d;
  string name;
  int sent;
  function new(string n, mailbox mbox);
    sent = 10;
    this.d = mbox;
    this.name = n;    
  endfunction

  task run();
    $display("Driver Run");
    $display("Driver sending: %0d",sent);
    d.put(sent);
  endtask // run
endclass

class monitor;
  string name;
  mailbox m;
  int received;
  function new(string n, mailbox mbox);
    this.m = mbox;
    this.name = n;
  endfunction

  task run();
    $display("Monitor Run");
    #1;
    m.get(received);
    $display("Monitor receiving: %0d",received);
  endtask // run
endclass

module tbench_top;  
  // classes
  driver drv;
  monitor mon;

  // mailbox
  mailbox main_mbox;

  initial begin
    main_mbox = new(1);
    drv = new("driver",main_mbox);
    mon = new("monitor", main_mbox);
    #10;
    fork
      drv.run();
      mon.run();
    join
    #10;
    $finish();
  end 
endmodule

Quite simple code using Classes (not inherited) and I run using these 2 command:

surelog_parse: clean
	@cd ${root_dir}/build && ${SURELOG_BIN} -parse -sverilog -d coveruhdm ${SURELOG_FLAGS} $(TOP_FILE)
	@cp ${root_dir}/build/slpp_all/surelog.uhdm ${TOP_UHDM}

run: surelog_parse
	$(VERILATOR_BIN) --uhdm-ast-sv --dump-uhdm --cc $(TOP_UHDM) $(VERILATOR_FLAGS) --top-module ${TOP_MODULE} --dump-uhdm --exe $(MAIN_FILE) --trace && make -j -C obj_dir -f $(TOP_MAKEFILE) $(VERILATED_BIN) && obj_dir/$(VERILATED_BIN)
	@mv $(root_dir)/build/dump.vcd $(root_dir)/dumps/dump_verilator.vcd

On my side unfortunately is hanging due to probably issues with the UHDM_VERILATOR build (The ast test as well I probably might need to reinstall it back again).

Could you guys give it a shot I knew they were not supported initially but probably they are still not well supported. Thanks so much

@kbieganski
Copy link
Collaborator

Unfortunately, a bunch of the features used in your code aren't supported yet by either Verilator or Surelog.

  • class support is very basic in Surelog right now, and I don't think there's been any progress on that front recently,
  • AFAIK mailboxes aren't supported by upstream Verilator (and there's not much we can do about it in a frontend),
  • forks and delays aren't supported by upstream Verilator, but they are by this version (for a summary of changes and some examples, click here).

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

No branches or pull requests

2 participants