Created
January 29, 2014 14:12
-
-
Save tejainece/8688765 to your computer and use it in GitHub Desktop.
Read output ports in Verilog and VHDL. This was written for my blog post.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library IEEE; | |
use IEEE.STD_LOGIC_1164.ALL; | |
entity ReadOutputCorrect is | |
PORT ( | |
in1 : IN STD_LOGIC; | |
in2 : IN STD_LOGIC; | |
in3 : IN STD_LOGIC; | |
o1 : OUT STD_LOGIC; | |
o2 : OUT STD_LOGIC | |
); | |
end ReadOutputCorrect; | |
architecture Behavioral of ReadOutputCorrect is | |
SIGNAL tmp1_o1 : STD_LOGIC; | |
begin | |
tmp1_o1 <= in1 and in2; | |
o1 <= tmp1_o1; | |
o2 <= tmp1_o1 and in3; | |
end Behavioral; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
entity ReadOutputWrong is | |
PORT ( | |
in1 : IN STD_LOGIC; | |
in2 : IN STD_LOGIC; | |
in3 : IN STD_LOGIC; | |
o1 : OUT STD_LOGIC; | |
o2 : OUT STD_LOGIC | |
); | |
end ReadOutputWrong; | |
architecture Behavioral of ReadOutputWrong is | |
begin | |
o1 <= in1 and in2; | |
o2 <= o1 and in3; | |
end Behavioral; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ReadTheOut( | |
in1, in2, in3, o1, o2 | |
); | |
input in1, in2, in3; | |
output o1, o2; | |
assign o1 = in1 & in2; | |
assign o2 = o1 & in3; | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment