diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-19 11:08:24 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-19 11:08:24 +0100 |
commit | d4d84543f9d63a5a54e549aaba60fe26c7e8421c (patch) | |
tree | 2261e06d6aa98aafa9f779db8925e41a94c920c4 /VHDL.wiki | |
parent | Tue, 19 Feb 2019 11:03:21 +0100 (diff) | |
download | wiki-public-d4d84543f9d63a5a54e549aaba60fe26c7e8421c.tar.gz wiki-public-d4d84543f9d63a5a54e549aaba60fe26c7e8421c.tar.xz |
Tue, 19 Feb 2019 11:08:23 +0100
Diffstat (limited to 'VHDL.wiki')
-rw-r--r-- | VHDL.wiki | 31 |
1 files changed, 28 insertions, 3 deletions
@@ -117,15 +117,40 @@ Allting i VHDL är paralellt by default, dock finns: == Annat trevligt == +{{{VHDL +entity mux is + port (d : in std_logic_vector (0 to 3); + s : in std_logic_vector (1 downto 0); + y : out std_logic_vector); +end entity mux; +}}} + === with-select-when === +Är begränsad till att högerledet måste vara ett "simpelt" uttryck. + +{{{VHDL +architecture behavior1 of mux is +begin + with s select + y <= d(0) when "00", + d(1) when "01", + d(2) when "10", + d(3) when others; +end architecture behavior1; +}}} + === when-else === Tillåter "krångliga" uttryck i högerledet. Första sanna villkoret bestämmer. Allting körs parallellt? {{{VHDL -y <= d(0) when s = "00" else - d(1) when s = "01" else - d(2); +architecture behavior2 of mux is +begin + y <= d(0) when s = "00" else + d(1) when s = "01" else + d(2) when s = "10" else + d(3); +end architecture behavior2; }}} |