zoukankan      html  css  js  c++  java
  • VHDL之concurrent之operators

    Using operators

      Operators can be used to implement any combinational circuit. However, as will become apparent later, complex circuits are usually easier to write using sequential code, even if the circuit does not contain sequential logic.

      

    Example  Multiplexer  

      

     1 ---------------------------------------
     2 LIBRARY ieee;
     3 USE ieee.std_logic_1164.all;
     4 ---------------------------------------
     5 ENTITY mux IS
     6 PORT ( a, b, c, d, s0, s1: IN STD_LOGIC;
     7     y: OUT STD_LOGIC);
     8 END mux;
     9 ---------------------------------------
    10  ARCHITECTURE pure_logic OF mux IS
    11  BEGIN
    12   y <= (a AND NOT s1 AND NOT s0) OR
    13      (b AND NOT s1 AND s0) OR
    14      (c AND s1 AND NOT s0) OR
    15      (d AND s1 AND s0);
    16  END pure_logic;
    17  ---------------------------------------

    Miscellaneous operators

        **    Exponentiation

        abs      Absolute value

      The exponentiation operator has two operands. This operator is defined for any integer or floating point number. The right operand (exponent) must be of integer type. When the exponent is the positive integer, then the left operand is repeatedly multiplied by itself. When the exponent is the negative number, then the result is a reverse of exponentiation with the exponent equal to the absolute value of the right operand. If the exponent is equal to 0 the result will be 1.

      The abs operator has only one operand. It allows defining the operand's absolute value. The result is of the same type as the operand.

    2 ** 8 = 256
    3.8 ** 3 = 54.872
    4 ** (-2) = 1 / (4**2) = 0.0625
  • 相关阅读:
    利用strstr和sscanf解析GPS信息
    利用STM32CubeMX之SPI
    浅析USB之设备枚举
    利用STM32CubeMX来生成USB_HID_host工程
    利用pyusb来查询当前所以usb设备
    usb之python(pyusb)
    使用STM32CubeMX生成USB_HOST_HID工程[添加对CAPS_LOCK指示灯的控制][SetReport]
    java基本数据类型
    shell kill掉含同一字符的关键字的进程
    Java之内存分析和String对象
  • 原文地址:https://www.cnblogs.com/mengdie/p/4518317.html
Copyright © 2011-2022 走看看