cambridgehackers / connectal

Connectal is a framework for software-driven hardware development.
MIT License
161 stars 46 forks source link

fixed bug in topgen.py with multiple portalReaders and portalWriters #122

Closed acw1251 closed 8 years ago

acw1251 commented 8 years ago

This fixed a syntax error in the generated Top.bsv when my module has multiple vectors of MemReadClients in its interface.

jameyhicks commented 8 years ago

I'm sure this was a case we never thought of. Looks OK, let's see how it goes.

acw1251 commented 8 years ago

Just for reference, this is the interface:

interface ProcConnectal;
    interface ProcControlRequest procControlRequest;
    interface HostInterfaceRequest hostInterfaceRequest;
    interface PerfMonitorRequest perfMonitorRequest;
    interface ExternalMMIOResponse externalMMIOResponse;
    interface Vector#(1, MemReadClient#(64)) dmaReadClient;
    interface Vector#(1, MemWriteClient#(64)) dmaWriteClient;
    interface Vector#(1, MemReadClient#(64)) romReadClient;
endinterface

This is in the old generated code:

   interface readers = take(append(lProcConnectal.dmaReadClient, lProcConnectal.romReadClient, nullReaders));
   interface writers = take(append(lProcConnectal.dmaWriteClient, nullWriters));

It produces this error:

Error: "/home/acwright/riscy-release-candidate/procs/RV64G_multicycle_merged/verilator/generatedbsv/Top.bsv", line 86, column 29: (T0081)
  Wrong number of arguments in the use of the following function:
    append

  The function expects 2 arguments but was used with 3 arguments.

  Expected type:
    function Vector::Vector#(d__, b__) f(Vector::Vector#(a__, b__) x1, Vector::Vector#(c__, b__) x2)

  Inferred type:
    function Vector::Vector#(h__, MemTypes::MemReadClient#(ConnectalConfig::DataBusWidth)) f(e__ x1,
                                                                                         f__ x2,
                                                                                         g__ x3)

And this is the generated code after the fix:

   interface readers = take(append(lProcConnectal.dmaReadClient,append(lProcConnectal.romReadClient,nullReaders)));
   interface writers = take(append(lProcConnectal.dmaWriteClient,nullWriters));
jameyhicks commented 8 years ago

I would usually combine the read clients, but I see the value in keeping them separate. Thanks for the patch!