sifive / duh

👾 Design ∪ Hardware
https://observablehq.com/@drom/duh-intro
Apache License 2.0
72 stars 6 forks source link

replace master/slave -> initiator/target #79

Open drom opened 4 years ago

drom commented 4 years ago

duh-schema

onInitiator & onTarget for bus definitions

component.busInterface[].interfaceMode -> enum: ['initiator', 'target']

duh-bus

onInitiator & onTarget for bus definitions

duh-core

no changes

duh-ipxact

duh-scala

adeelliaquat-lm commented 4 years ago

We did some work on this issue, as shown in code below. Is this the required output or are we missing something here ?

Sample code:

{
    "component": {
        "vendor": "sifive",
        "library": "blocks",
        "name": "pio",
        "version": "0.1.0",
        "busInterfaces": [
            {"$ref": "#/definitions/busDefinitions/busint-portgroup_0-mapping_0-prefix_t_ctrl-target-AXI5-Lite_rtl"},
            {"$ref": "#/definitions/bundleDefinitions/bundle-root"}
        ],
        "addressSpaces": [],
        "memoryMaps": [],
        "model": {
            "views": [],
            "ports": {
                "$ref": "#/definitions/ports"
            }
        },
        "fileSets": {},
        "pSchema": {},
        "busInterfaceAlts": [
            {"$ref": "#/definitions/busDefinitions/busint-portgroup_0-mapping_1-prefix_t_ctrl-target-AXI4-Lite_rtl"},
            {"$ref": "#/definitions/busDefinitions/busint-portgroup_0-mapping_2-prefix_t_ctrl-target-AXI4_rtl"},
            {"$ref": "#/definitions/busDefinitions/busint-portgroup_0-mapping_3-prefix_t_ctrl-initiator-APB4_rtl"},
            {"$ref": "#/definitions/busDefinitions/busint-portgroup_0-mapping_4-prefix_t_ctrl-initiator-AXI4-Lite_rtl"},
            {"$ref": "#/definitions/busDefinitions/busint-portgroup_0-mapping_5-prefix_t_ctrl-target-AXI4Stream_rtl"},
            {"$ref": "#/definitions/busDefinitions/busint-portgroup_0-mapping_6-prefix_t_ctrl-target-APB4_rtl"},
            {"$ref": "#/definitions/busDefinitions/busint-portgroup_0-mapping_7-prefix_t_ctrl-initiator-AXI5-Lite_rtl"}
        ]
    },
    "definitions": {
        "ports": {
            "t_ctrl_awvalid": 1,
            "t_ctrl_awready": -1,
            "t_ctrl_awaddr": "addrWidth",
            "t_ctrl_awprot": 3,
            "t_ctrl_wvalid": 1,
            "t_ctrl_wready": -1,
            "t_ctrl_wdata": "dataWidth",
            "t_ctrl_wstrb": "writeStrobeWidth",
            "t_ctrl_bvalid": -1,
            "t_ctrl_bready": 1,
            "t_ctrl_bresp": -2,
            "t_ctrl_arvalid": 1,
            "t_ctrl_arready": -1,
            "t_ctrl_araddr": "addrWidth",
            "t_ctrl_arprot": 3,
            "t_ctrl_rvalid": -1,
            "t_ctrl_rready": 1,
            "t_ctrl_rdata": "-(dataWidth)",
            "t_ctrl_rresp": -2,
            "irq0": -1,
            "irq1": -1,
            "odata": "-(pioWidth)",
            "oenable": "-(pioWidth)",
            "idata": "pioWidth",
            "clk": 1,
            "reset_n": 1,
            "t_ctrl_awsize": 1,
            "t_ctrl_arsize": 1,
            "t_ctrl_AWID": 1,
            "t_ctrl_BID": 1,
            "t_ctrl_RID": 1,
            "t_ctrl_ARID": 1,
            "t_ctrl_AWIDUNQ": 1,
            "t_ctrl_BIDUNQ": 1,
            "t_ctrl_RIDUNQ": 1,
            "t_ctrl_ARIDUNQ": 1,
            "t_ctrl_AWTRACE": 1,
            "t_ctrl_WTRACE": 1,
            "t_ctrl_BTRACE": 1,
            "t_ctrl_RPOISON": 1,
            "t_ctrl_WPOISON": 1,
            "t_ctrl_RTRACE": 1,
            "t_ctrl_ARTRACE": 1,
            "t_ctrl_AWAKEUP": 1
        },
        "pg_cnt": 1,
        "busDefinitions": {
            "busint-portgroup_0-mapping_0-prefix_t_ctrl-target-AXI5-Lite_rtl": {
                "name": "t_ctrl",
                "interfaceMode": "target",
                "busType": {
                    "vendor": "amba.com",
                    "library": "AMBA5",
                    "name": "AXI5-Lite",
                    "version": "bil_0"
                },
                "abstractionTypes": [
                    {
                        "viewRef": "RTLview",
                        "portMaps": {
                            "ARSIZE": "t_ctrl_arsize",
                            "AWTRACE": "t_ctrl_AWTRACE",
                            "ARID": "t_ctrl_ARID",
                            "WDATA": "t_ctrl_wdata",
                            "RID": "t_ctrl_RID",
                            "RPOISON": "t_ctrl_RPOISON",
                            "ARREADY": "t_ctrl_arready",
                            "BTRACE": "t_ctrl_BTRACE",
                            "AWADDR": "t_ctrl_awaddr",
                            "AWIDUNQ": "t_ctrl_AWIDUNQ",
                            "WTRACE": "t_ctrl_WTRACE",
                            "RVALID": "t_ctrl_rvalid",
                            "AWSIZE": "t_ctrl_awsize",
                            "RDATA": "t_ctrl_rdata",
                            "RTRACE": "t_ctrl_RTRACE",
                            "RREADY": "t_ctrl_rready",
                            "BIDUNQ": "t_ctrl_BIDUNQ",
                            "WPOISON": "t_ctrl_WPOISON",
                            "ARIDUNQ": "t_ctrl_ARIDUNQ",
                            "ARPROT": "t_ctrl_arprot",
                            "WVALID": "t_ctrl_wvalid",
                            "AWVALID": "t_ctrl_awvalid",
                            "RRESP": "t_ctrl_rresp",
                            "ARTRACE": "t_ctrl_ARTRACE",
                            "BRESP": "t_ctrl_bresp",
                            "AWID": "t_ctrl_AWID",
                            "BVALID": "t_ctrl_bvalid",
                            "AWPROT": "t_ctrl_awprot",
                            "ARVALID": "t_ctrl_arvalid",
                            "RIDUNQ": "t_ctrl_RIDUNQ",
                            "WSTRB": "t_ctrl_wstrb",
                            "WREADY": "t_ctrl_wready",
                            "AWAKEUP": "t_ctrl_AWAKEUP",
                            "BREADY": "t_ctrl_bready",
                            "BID": "t_ctrl_BID",
                            "ARADDR": "t_ctrl_araddr",
                            "AWREADY": "t_ctrl_awready"
                        }
                    }
                ]
            },
            "busint-portgroup_0-mapping_1-prefix_t_ctrl-target-AXI4-Lite_rtl": {
                "name": "t_ctrl",
                "interfaceMode": "target",
                "busType": {
                    "vendor": "amba.com",
                    "library": "AMBA4",
                    "name": "AXI4-Lite",
                    "version": "r0p0_0"
                },
                "abstractionTypes": [
                    {
                        "viewRef": "RTLview",
                        "portMaps": {
                            "AWADDR": "t_ctrl_awaddr",
                            "AWVALID": "t_ctrl_awvalid",
                            "AWREADY": "t_ctrl_awready",
                            "WDATA": "t_ctrl_wdata",
                            "WSTRB": "t_ctrl_wstrb",
                            "WVALID": "t_ctrl_wvalid",
                            "WREADY": "t_ctrl_wready",
                            "BVALID": "t_ctrl_bvalid",
                            "BREADY": "t_ctrl_bready",
                            "ARADDR": "t_ctrl_araddr",
                            "ARVALID": "t_ctrl_arvalid",
                            "ARREADY": "t_ctrl_arready",
                            "RDATA": "t_ctrl_rdata",
                            "RVALID": "t_ctrl_rvalid",
                            "RREADY": "t_ctrl_rready",
                            "AWPROT": "t_ctrl_awprot",
                            "BRESP": "t_ctrl_bresp",
                            "ARPROT": "t_ctrl_arprot",
                            "RRESP": "t_ctrl_rresp",
                            "ARUSER": [
                                "t_ctrl_arsize",
                                "t_ctrl_ARIDUNQ",
                                "t_ctrl_ARID",
                                "t_ctrl_ARTRACE"
                            ],
                            "AWUSER": [
                                "t_ctrl_AWTRACE",
                                "t_ctrl_AWIDUNQ",
                                "t_ctrl_AWID",
                                "t_ctrl_awsize",
                                "t_ctrl_AWAKEUP"
                            ],
                            "WUSER": [
                                "t_ctrl_WTRACE",
                                "t_ctrl_WPOISON"
                            ],
                            "__UMAP__": [
                                "t_ctrl_RID",
                                "t_ctrl_RPOISON",
                                "t_ctrl_BTRACE",
                                "t_ctrl_RIDUNQ",
                                "t_ctrl_RTRACE",
                                "t_ctrl_BIDUNQ",
                                "t_ctrl_BID"
                            ]
                        }
                    }
                ]
            },
            "busint-portgroup_0-mapping_2-prefix_t_ctrl-target-AXI4_rtl": {
                "name": "t_ctrl",
                "interfaceMode": "target",
                "busType": {
                    "vendor": "amba.com",
                    "library": "AMBA4",
                    "name": "AXI4",
                    "version": "r0p0_0"
                },
                "abstractionTypes": [
                    {
                        "viewRef": "RTLview",
                        "portMaps": {
                            "ARID": "t_ctrl_ARID",
                            "WDATA": "t_ctrl_wdata",
                            "ARREADY": "t_ctrl_arready",
                            "AWADDR": "t_ctrl_awaddr",
                            "RVALID": "t_ctrl_rvalid",
                            "RDATA": "t_ctrl_rdata",
                            "RREADY": "t_ctrl_rready",
                            "ARPROT": "t_ctrl_arprot",
                            "WVALID": "t_ctrl_wvalid",
                            "AWVALID": "t_ctrl_awvalid",
                            "RRESP": "t_ctrl_rresp",
                            "BRESP": "t_ctrl_bresp",
                            "AWID": "t_ctrl_AWID",
                            "BVALID": "t_ctrl_bvalid",
                            "AWPROT": "t_ctrl_awprot",
                            "ARVALID": "t_ctrl_arvalid",
                            "WSTRB": "t_ctrl_wstrb",
                            "WREADY": "t_ctrl_wready",
                            "BREADY": "t_ctrl_bready",
                            "ARADDR": "t_ctrl_araddr",
                            "AWREADY": "t_ctrl_awready",
                            "ARSIZE": "t_ctrl_arsize",
                            "AWSIZE": "t_ctrl_awsize",
                            "ARUSER": [
                                "t_ctrl_ARIDUNQ",
                                "t_ctrl_ARTRACE"
                            ],
                            "AWUSER": [
                                "t_ctrl_AWTRACE",
                                "t_ctrl_AWIDUNQ",
                                "t_ctrl_AWAKEUP"
                            ],
                            "WUSER": [
                                "t_ctrl_WTRACE",
                                "t_ctrl_WPOISON"
                            ],
                            "__UMAP__": [
                                "t_ctrl_RIDUNQ",
                                "t_ctrl_RID",
                                "t_ctrl_RPOISON",
                                "t_ctrl_RTRACE",
                                "t_ctrl_BTRACE",
                                "t_ctrl_BIDUNQ",
                                "t_ctrl_BID"
                            ]
                        }
                    }
                ]
            },
            "busint-portgroup_0-mapping_3-prefix_t_ctrl-initiator-APB4_rtl": {
                "name": "t_ctrl",
                "interfaceMode": "initiator",
                "busType": {
                    "vendor": "amba.com",
                    "library": "AMBA4",
                    "name": "APB4",
                    "version": "r0p0_0"
                },
                "abstractionTypes": [
                    {
                        "viewRef": "RTLview",
                        "portMaps": {
                            "PREADY": "t_ctrl_rready",
                            "PRDATA": "t_ctrl_wdata",
                            "PSTRB": "t_ctrl_bresp",
                            "PADDR": "t_ctrl_arready",
                            "PWRITE": "t_ctrl_wready",
                            "PCLKEN": "t_ctrl_AWAKEUP",
                            "PWDATA": "t_ctrl_awready",
                            "PPROT": "t_ctrl_rdata",
                            "PCLK": "t_ctrl_RTRACE",
                            "PSEL": "t_ctrl_rvalid",
                            "__UMAP__": [
                                "t_ctrl_arsize",
                                "t_ctrl_AWTRACE",
                                "t_ctrl_ARIDUNQ",
                                "t_ctrl_ARID",
                                "t_ctrl_RID",
                                "t_ctrl_arprot",
                                "t_ctrl_RPOISON",
                                "t_ctrl_wvalid",
                                "t_ctrl_BTRACE",
                                "t_ctrl_awaddr",
                                "t_ctrl_awvalid",
                                "t_ctrl_AWIDUNQ",
                                "t_ctrl_rresp",
                                "t_ctrl_ARTRACE",
                                "t_ctrl_WTRACE",
                                "t_ctrl_AWID",
                                "t_ctrl_bvalid",
                                "t_ctrl_awsize",
                                "t_ctrl_awprot",
                                "t_ctrl_arvalid",
                                "t_ctrl_RIDUNQ",
                                "t_ctrl_wstrb",
                                "t_ctrl_BIDUNQ",
                                "t_ctrl_bready",
                                "t_ctrl_BID",
                                "t_ctrl_araddr",
                                "t_ctrl_WPOISON"
                            ]
                        }
                    }
                ]
            },
            "busint-portgroup_0-mapping_4-prefix_t_ctrl-initiator-AXI4-Lite_rtl": {
                "name": "t_ctrl",
                "interfaceMode": "initiator",
                "busType": {
                    "vendor": "amba.com",
                    "library": "AMBA4",
                    "name": "AXI4-Lite",
                    "version": "r0p0_0"
                },
                "abstractionTypes": [
                    {
                        "viewRef": "RTLview",
                        "portMaps": {
                            "ARVALID": "t_ctrl_rvalid",
                            "RVALID": "t_ctrl_arvalid",
                            "ARREADY": "t_ctrl_rready",
                            "RREADY": "t_ctrl_arready",
                            "WVALID": "t_ctrl_bvalid",
                            "WREADY": "t_ctrl_bready",
                            "BVALID": "t_ctrl_wvalid",
                            "BREADY": "t_ctrl_wready",
                            "WDATA": "t_ctrl_rdata",
                            "RDATA": "t_ctrl_wdata",
                            "AWVALID": "t_ctrl_awvalid",
                            "AWPROT": "t_ctrl_awprot",
                            "ARPROT": "t_ctrl_arprot",
                            "AWUSER": [
                                "t_ctrl_awready"
                            ],
                            "BUSER": [
                                "t_ctrl_BTRACE",
                                "t_ctrl_BIDUNQ",
                                "t_ctrl_BID"
                            ],
                            "RUSER": [
                                "t_ctrl_RID",
                                "t_ctrl_RPOISON",
                                "t_ctrl_RIDUNQ",
                                "t_ctrl_RTRACE"
                            ],
                            "__UMAP__": [
                                "t_ctrl_arsize",
                                "t_ctrl_AWTRACE",
                                "t_ctrl_ARIDUNQ",
                                "t_ctrl_ARID",
                                "t_ctrl_awaddr",
                                "t_ctrl_AWIDUNQ",
                                "t_ctrl_rresp",
                                "t_ctrl_ARTRACE",
                                "t_ctrl_bresp",
                                "t_ctrl_WTRACE",
                                "t_ctrl_AWID",
                                "t_ctrl_awsize",
                                "t_ctrl_wstrb",
                                "t_ctrl_AWAKEUP",
                                "t_ctrl_araddr",
                                "t_ctrl_WPOISON"
                            ]
                        }
                    }
                ]
            },
            "busint-portgroup_0-mapping_5-prefix_t_ctrl-target-AXI4Stream_rtl": {
                "name": "t_ctrl",
                "interfaceMode": "target",
                "busType": {
                    "vendor": "amba.com",
                    "library": "AMBA4",
                    "name": "AXI4Stream",
                    "version": "r0p0_1"
                },
                "abstractionTypes": [
                    {
                        "viewRef": "RTLview",
                        "portMaps": {
                            "TVALID": "t_ctrl_wvalid",
                            "TREADY": "t_ctrl_wready",
                            "TSTRB": "t_ctrl_wstrb",
                            "TDATA": "t_ctrl_wdata",
                            "TID": "t_ctrl_RID",
                            "TKEEP": "t_ctrl_AWAKEUP",
                            "ACLK": "t_ctrl_RTRACE",
                            "TUSER": [
                                "t_ctrl_arsize",
                                "t_ctrl_AWTRACE",
                                "t_ctrl_ARIDUNQ",
                                "t_ctrl_ARID",
                                "t_ctrl_arprot",
                                "t_ctrl_RPOISON",
                                "t_ctrl_BTRACE",
                                "t_ctrl_awaddr",
                                "t_ctrl_awvalid",
                                "t_ctrl_AWIDUNQ",
                                "t_ctrl_ARTRACE",
                                "t_ctrl_WTRACE",
                                "t_ctrl_AWID",
                                "t_ctrl_awsize",
                                "t_ctrl_awprot",
                                "t_ctrl_arvalid",
                                "t_ctrl_RIDUNQ",
                                "t_ctrl_rready",
                                "t_ctrl_BIDUNQ",
                                "t_ctrl_bready",
                                "t_ctrl_BID",
                                "t_ctrl_araddr",
                                "t_ctrl_WPOISON"
                            ],
                            "__UMAP__": [
                                "t_ctrl_arready",
                                "t_ctrl_rresp",
                                "t_ctrl_rvalid",
                                "t_ctrl_bresp",
                                "t_ctrl_rdata",
                                "t_ctrl_bvalid",
                                "t_ctrl_awready"
                            ]
                        }
                    }
                ]
            },
            "busint-portgroup_0-mapping_6-prefix_t_ctrl-target-APB4_rtl": {
                "name": "t_ctrl",
                "interfaceMode": "target",
                "busType": {
                    "vendor": "amba.com",
                    "library": "AMBA4",
                    "name": "APB4",
                    "version": "r0p0_0"
                },
                "abstractionTypes": [
                    {
                        "viewRef": "RTLview",
                        "portMaps": {
                            "PRDATA": "t_ctrl_rdata",
                            "PWDATA": "t_ctrl_wdata",
                            "PREADY": "t_ctrl_wready",
                            "PSTRB": "t_ctrl_wstrb",
                            "PPROT": "t_ctrl_arprot",
                            "PADDR": "t_ctrl_araddr",
                            "PSEL": "t_ctrl_arsize",
                            "PCLK": "t_ctrl_RTRACE",
                            "__UMAP__": [
                                "t_ctrl_AWTRACE",
                                "t_ctrl_ARIDUNQ",
                                "t_ctrl_ARID",
                                "t_ctrl_RID",
                                "t_ctrl_RPOISON",
                                "t_ctrl_arready",
                                "t_ctrl_wvalid",
                                "t_ctrl_BTRACE",
                                "t_ctrl_awaddr",
                                "t_ctrl_awvalid",
                                "t_ctrl_AWIDUNQ",
                                "t_ctrl_rresp",
                                "t_ctrl_ARTRACE",
                                "t_ctrl_WTRACE",
                                "t_ctrl_bresp",
                                "t_ctrl_rvalid",
                                "t_ctrl_AWID",
                                "t_ctrl_awsize",
                                "t_ctrl_bvalid",
                                "t_ctrl_awprot",
                                "t_ctrl_arvalid",
                                "t_ctrl_RIDUNQ",
                                "t_ctrl_rready",
                                "t_ctrl_BIDUNQ",
                                "t_ctrl_AWAKEUP",
                                "t_ctrl_bready",
                                "t_ctrl_BID",
                                "t_ctrl_awready",
                                "t_ctrl_WPOISON"
                            ]
                        }
                    }
                ]
            },
            "busint-portgroup_0-mapping_7-prefix_t_ctrl-initiator-AXI5-Lite_rtl": {
                "name": "t_ctrl",
                "interfaceMode": "initiator",
                "busType": {
                    "vendor": "amba.com",
                    "library": "AMBA5",
                    "name": "AXI5-Lite",
                    "version": "bil_0"
                },
                "abstractionTypes": [
                    {
                        "viewRef": "RTLview",
                        "portMaps": {
                            "RVALID": "t_ctrl_arvalid",
                            "RREADY": "t_ctrl_arready",
                            "AWTRACE": "t_ctrl_AWTRACE",
                            "ARID": "t_ctrl_ARID",
                            "RID": "t_ctrl_RID",
                            "RPOISON": "t_ctrl_RPOISON",
                            "AWIDUNQ": "t_ctrl_AWIDUNQ",
                            "WTRACE": "t_ctrl_WTRACE",
                            "AWSIZE": "t_ctrl_awsize",
                            "BIDUNQ": "t_ctrl_BIDUNQ",
                            "WPOISON": "t_ctrl_WPOISON",
                            "ARIDUNQ": "t_ctrl_ARIDUNQ",
                            "ARPROT": "t_ctrl_arprot",
                            "AWVALID": "t_ctrl_awvalid",
                            "ARTRACE": "t_ctrl_ARTRACE",
                            "AWID": "t_ctrl_AWID",
                            "AWPROT": "t_ctrl_awprot",
                            "RIDUNQ": "t_ctrl_RIDUNQ",
                            "AWAKEUP": "t_ctrl_AWAKEUP",
                            "BID": "t_ctrl_BID",
                            "AWUSER": [
                                "t_ctrl_awready"
                            ],
                            "BUSER": [
                                "t_ctrl_BTRACE",
                                "t_ctrl_bready"
                            ],
                            "RUSER": [
                                "t_ctrl_RTRACE",
                                "t_ctrl_rready"
                            ],
                            "WUSER": [
                                "t_ctrl_wready"
                            ],
                            "__UMAP__": [
                                "t_ctrl_arsize",
                                "t_ctrl_rvalid",
                                "t_ctrl_bvalid",
                                "t_ctrl_rdata",
                                "t_ctrl_wdata",
                                "t_ctrl_wvalid",
                                "t_ctrl_awaddr",
                                "t_ctrl_wstrb",
                                "t_ctrl_rresp",
                                "t_ctrl_araddr",
                                "t_ctrl_bresp"
                            ]
                        }
                    }
                ]
            }
        },
        "busMappedPortGroups": [
            [
                "portgroup_0",
                [
                    [
                        "num_ports",
                        37
                    ],
                    [
                        "prefix",
                        "t_ctrl_"
                    ],
                    [
                        "num-direction-mismatch",
                        0
                    ],
                    [
                        "num-width-mismatch",
                        0
                    ]
                ]
            ]
        ],
        "bundleDefinitions": {
            "bundle-root": {
                "name": "root",
                "interfaceMode": null,
                "busType": "bundle",
                "abstractionTypes": [
                    {
                        "viewRef": "RTLview",
                        "portMaps": {
                            "irq": [
                                "irq0",
                                "irq1"
                            ],
                            "odata": "odata",
                            "oenable": "oenable",
                            "idata": "idata",
                            "clk": "clk",
                            "reset_n": "reset_n"
                        }
                    }
                ]
            }
        }
    }
}