vhdl code

Thread Starter

avalox7

Joined Aug 9, 2020
31
architecture behavioral of circuit1 is
signal a:std_logic_vector(1 downto 0);
signal b:std_logic_vector(3 downto 0);
signal f:std_logic;
begin
f<=B(0) when A=''00'' else
B(1) when A=''01'' else
B(2) when A=''10'' else
B(3);
end behavioral;
Please help me with this code I need it for exam tommorow,is this a decoder?
 

Thread Starter

avalox7

Joined Aug 9, 2020
31
b is four bite,so when b(0) that means is 0001,when b(1) is 0010,b(2) is 0100,b(3) is 1000,so it codes this b(0),b(1).. depending on A,so I think is encoder,because it is encoding,if it was decoder we will have 0001,0010,..at the output.
 

WBahn

Joined Mar 31, 2012
26,301
'b' is four bits (not four bite). b(0) does not mean 0001. It merely refers to the signal on bit 0 of 'b' and it could be either a 0 or a 1. The value on the other bits is immaterial.

It sounds like you need to take a step back and get up to speed on the basic syntax and semantics of VHDL before you start worrying about encoders and decoder and whether this circuit is even either of those.
 

WBahn

Joined Mar 31, 2012
26,301
F stores the value of b(0),b(1) depending on what A is
F doesn't "store" the value, be careful about using that terminology as it has a very specific connotation when talking about digital systems.

But if F is equal to one of a set of signals depending on what value another signal has, that describes what digital logic component?
 

Thread Starter

avalox7

Joined Aug 9, 2020
31
F doesn't "store" the value, be careful about using that terminology as it has a very specific connotation when talking about digital systems.

But if F is equal to one of a set of signals depending on what value another signal has, that describes what digital logic component?
F doesn't "store" the value, be careful about using that terminology as it has a very specific connotation when talking about digital systems.

But if F is equal to one of a set of signals depending on what value another signal has, that describes what digital logic component?
encoder
 

andrewmm

Joined Feb 25, 2011
658
Just one thing,

the very best with your exam tomorrow.
you know a lot more than you think right now,
go and do some exercise, run around the block go to gym or something before you go to bed,
then get some sleep,

Good luck and may your god be with you ,
 

andrewmm

Joined Feb 25, 2011
658

Thread Starter

avalox7

Joined Aug 9, 2020
31
Just one thing,

the very best with your exam tomorrow.
you know a lot more than you think right now,
go and do some exercise, run around the block go to gym or something before you go to bed,
then get some sleep,

Good luck and may your god be with you ,
Thanks a lot,may God be with all of us.
 
Top