是否可以在vhdl中使用泛型类型?(Is it possible to have generic type in vhdl?)
VHDL中有没有一种方法可以使用泛型类型? 所以例如我想调用一个过程,但是我不确定我想要作为参数给出的信号类型,是否可以将参数声明为通用? 就像在C ++中一样,你会使用一个模板。
procedure eq_checker(name : string; sig : ANYTHING); should : ANYTHING; at : time) is if (at = now) then if sig = should then report "has same value" severity note; else report "has not same value" severity note; end if; end if; end checker;
至少应该可以使用不同的信号类型作为“sig”。
Is there a way in VHDL to have generic types? So for example I want to call a procedure but I'm not sure what type the signal has I want to give as paarameter, is it possible to declare the parameter as generic? Like in C++ you would use a Template.
procedure eq_checker(name : string; sig : ANYTHING); should : ANYTHING; at : time) is if (at = now) then if sig = should then report "has same value" severity note; else report "has not same value" severity note; end if; end if; end checker;
At least it should be possible to use different signal types as "sig".
原文:https://stackoverflow.com/questions/15382791
最满意答案
问题是我用于颜色变量的数据类型。 出于某种原因,sscanf不喜欢uint8_t,当我将它们切换到uint16_t时它工作得很好。
The issue was the data types I was using for the color variables. For some reason sscanf didnt like uint8_t, when i switched them to uint16_t it worked fine.
相关问答
更多-
什么是Arduino啊?[2022-03-29]
Arduino其实就是一个开放式的单片机 相对于单片机的优势是它是开源的 所有的代码都能够从网上下载到 但是可实现的功能可能比较片面 没有单片机广 适合喜欢自己DIY一些小东西的人 不适合做项目的开发 -
要转换并附加一个整数,请使用operator + = (或成员函数concat ): String stringOne = "A long integer: "; stringOne += 123456789; 要获取字符串作为类型char[] ,请使用toCharArray() : char charBuf[50]; stringOne.toCharArray(charBuf, 50) 在这个例子中,只有49个字符的空格(假定它被null终止)。 您可能希望使动画大小。 To convert and ...
-
从arduino到netmf(From arduino to netmf)[2022-10-01]
uint angle = 3000;//angle is int 500 to 5500 uint temp; byte pos_hi,pos_low; temp = angle & 0x1f80; //get bits 8 thru 13 of position pos_hi = (byte) (temp >> 7); //shift bits 8 thru 13 by 7 pos_low = (byte) (angle & 0x7f); //get lower 7 bits of posi ... -
如果看起来你正在开发一个Arduino项目,你应该简单地让Serial对象处理它: int GSM_BAUD_RATE; GSM_BAUD_RATE = 4800; Serial.print("GSM Shield running at "); Serial.print(GSM_BAUD_RATE); Serial.println(" baud rate."); 因为print和println方法有重载来处理几种不同的类型。 其他方法可以在“普通”机器上使用,但是像string和ostringstrea ...
-
函数receiveEvent作为Wire.onReceive()的事件处理程序提供。 所以,从Wire.onReceive的文档 handler:从站接收数据时要调用的函数; 这应该采用一个int参数(从master读取的字节数)并且不返回任何内容,例如: void myHandler(int numBytes) 它包含接收数据的字节数。 The function receiveEvent is provided as an event handler to Wire.onReceive(). So, fr ...
-
您将传入数组本身作为指向write函数的size参数的指针,该函数只接受一个正int。 尝试使用它来获取数组的长度: 的sizeof(ARR); You are passing in the array itself as a pointer into the size parameter of the write function, which only takes a positive int. Try using this to get the length of the array: sizeof( ...
-
问题是我用于颜色变量的数据类型。 出于某种原因,sscanf不喜欢uint8_t,当我将它们切换到uint16_t时它工作得很好。 The issue was the data types I was using for the color variables. For some reason sscanf didnt like uint8_t, when i switched them to uint16_t it worked fine.
-
Arduino:如果/其他问题(Arduino: If/Else issues)[2022-05-02]
该示例期望PubNub发布为“lightRight:1”而不是{“lightRight”:“1”}。 That example expects the PubNub publish to be "lightRight:1" and not {"lightRight": "1"}. -
好的,试试这个: int atoisub(char *s, int start, int end) { int rv = 0; for (int i = start; i < end; ++i) { rv = rv * 10 + (s[i] - '0'); } return rv; } 称为atoisub(myarray, 1, 4) 。 没有错误检查非数字字符或无效参数。 Ok, try this: int atoisub(char *s, int sta ...
-
int是基于AVR的MCU上的16位宽签名变量。 你的显然是一个32位的签名变量,所以我认为它是一个基于ARM的板。 无论如何4294967296-1是无符号整数( uint32_t )的uint32_t 。 对于int32_t它只有一半,即2147483647 。 关于atoi : 回报价值 成功时,该函数将转换后的整数作为int值返回。 如果转换后的值超出int的可表示值范围,则会导致未定义的行为。 如果可能的话,请参阅strtol以获得更强大的跨平台替代方案。 我的猜测是,在实践中,这种“未定义的行为 ...