首页 \ 问答 \ 是否可以在vhdl中使用泛型类型?(Is it possible to have generic type in vhdl?)

是否可以在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
更新时间:2023-10-04 09:10

最满意答案

问题是我用于颜色变量的数据类型。 出于某种原因,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其实就是一个开放式的单片机 相对于单片机的优势是它是开源的 所有的代码都能够从网上下载到 但是可实现的功能可能比较片面 没有单片机广 适合喜欢自己DIY一些小东西的人 不适合做项目的开发
  • 要转换并附加一个整数,请使用operator + = (或成员函数concat ): String stringOne = "A long integer: "; stringOne += 123456789; 要获取字符串作为类型char[] ,请使用toCharArray() : char charBuf[50]; stringOne.toCharArray(charBuf, 50) 在这个例子中,只有49个字符的空格(假定它被null终止)。 您可能希望使动画大小。 To convert and ...
  • 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.
  • 该示例期望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以获得更强大的跨平台替代方案。 我的猜测是,在实践中,这种“未定义的行为 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。