模块中可变大小和端口/阵列端口数,它们与Verilog System verilog中的参数相关

时间:2017-07-14 09:04:14

标签: verilog system-verilog

参考以下问题

How to write a module with variable number of ports in Verilog

我对此有另一个问题。

module my_module #(SIZEOF_LENGTH = 3,
                    LENGTH = {8,8,7})(
    input clk,
    input rst_n,
    input [LENGTH[0]-1:0] data_1,
    input [LENGTH[1]-1:0] data_2,
    input [LENGTH[2]-1:0] data_3
);

我基本上想要这样的东西。大小取决于从顶部传递的参数,端口数也是如此。可以这样做吗?

1 个答案:

答案 0 :(得分:0)

不在Verilog中,但可以使用像Ruby或Perl这样的模板语言。

或者在SystemVerilog阵列中可以使用以下端口: 请注意,这些宽度必须相同。

    public async Task<HttpResponseMessage> PostClause(ClauseRequest clauseRequest)
    {
        try
        {
            var channelId = "19:cf4306bb3aff4996.......@thread.skype";
            var serviceURL = "https://smba.trafficmanager.net/apac-client-ss.msg/";
            var connector = new ConnectorClient(new Uri(serviceURL));
            var channelData = new Dictionary<string, string>();
            channelData["teamsChannelId"] = channelId;
            IMessageActivity newMessage = Activity.CreateMessageActivity();
            newMessage.Type = ActivityTypes.Message;


            var good = new CardAction("invoke", "Good", null, "{\"invokeValue\": \"Good\"}");
            var bad = new CardAction("invoke", "Bad", null, "{\"invokeValue\": \"Bad\"}");
            var card = new HeroCard("How are you today?", null, null, null, new List<CardAction> { good, bad }).ToAttachment();


            newMessage.Attachments.Add(card);

            ConversationParameters conversationParams = new ConversationParameters(
                isGroup: true,
                bot: null,
                members: null,
                topicName: "Test Conversation",
                activity: (Activity)newMessage,
                channelData: channelData);
            MicrosoftAppCredentials.TrustServiceUrl(serviceURL, DateTime.MaxValue);
            await connector.Conversations.CreateConversationAsync(conversationParams);
            var response = Request.CreateResponse(HttpStatusCode.OK);
            return response;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }