Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity halfdder is
Port ( a,b : in STD_LOGIC;
Sum, carry : out STD_LOGIC);
end halfdder;
architecture Behavioral of halfdder is
begin
sum <= a xor b;
carry <= a and b;
end Behavioral
OUTPUT
EX NO: 1
DATE:
AIM:
To Design a Half adder and Full adder using VHDL programming in ModelSim.
COMPONENTS REQUIRED:
ModelSim tool
ALGORITHM:
STEP1
STEP2
: Write the Architecture for processing inputs a, b&cin and outputs sum, carry
According to the half adder and full adder function
STEP3
STEP 4
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity fulladder is
Port ( a ,b,c: in STD_LOGIC;
Sum, carry : out STD_LOGIC);
end fulladder;
architecture Behavioral of fulladder is
begin
sum <= (a xor b) xor c;
carry <= (a and b)or (b and c) or ( a and c);
end Behavioral;
OUTPUT
RESULT:
The Half Adder and Full Adder circuits designed using VHDL
Programming in ModelSim and verified its output successfully.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity hs is
Port ( a,b : in STD_LOGIC;
diff ,br: out STD_LOGIC);
end hs;
architecture Behavioral of hs is
begin
diff <= a xor b;
br <= (not a )and b;
end Behavioral;
OUTPUT
EX NO: 2
DATE:
AIM:
To Design a Half Subtractor and Full Subtractor using VHDL programming in ModelSim
COMPONENTS REQUIRED:
ModelSim tool
ALGORITHM:
STEP1
STEP2
STEP3
STEP 4
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity fs is
Port (a, b, c : in STD_LOGIC;
diff ,br: out STD_LOGIC);
end fs;
architecture Behavioral of fs is
begin
diff <=(a xor b) xor c;
br <= ((not a)and b)or(b and c) or ((not a) and c);
end Behavioral;
OUTPUT
RESULT:
The Half Subtractor and Full Subtractor circuits designed using VHDL
Programming in ModelSim and verified its output successfully.
EX NO: 3
DATE:
AIM:
To write a program to perform multiplexer and Demultiplexer using VHDL
programming.
COMPONENTS REQUIRED:
ModelSim tool
ALGORITHM:
STEP1
STEP2
STEP3
STEP 4
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use ieee.std_logic_unsigned.all;
entity demux is
port(
a : in BIT;
s : in BIT_VECTOR(2 downto 0);
y : out BIT_VECTOR(7 downto 0):="00000000"
);
end demux;
architecture demux of demux is
begin
process(s,a)
begin
case s is
when "000"=> y(0)<= a;
when "001"=> y(1)<= a;
when "010"=> y(2)<= a;
when "011"=> y(3)<= a;
when "100"=> y(4)<= a;
when "101"=> y(5)<= a;
when "110"=> y(6)<= a;
when "111"=> y(7)<= a;
when others =>null;
end case;
end process;
end demux;
RESULT
end behavioral;
OUTPUT:
DECODER
EX NO: 4
DATE:
AIM:
To write a program to perform decoder using VHDL programming.
COMPONENTS REQUIRED:
ModelSim tool
ALGORITHM:
STEP1
STEP2
: Write the Architecture for processing inputs according to the Decoder function
STEP3
STEP 4
RESULT
The Decoder circuit designed using VHDL Programming in ModelSim and verified its
output successfully
EX NO: 5
PARALLEL ADDER
DATE:
AIM:
To write a program to perform 4-bit Parallel binary Adder using VHDL programming.
COMPONENTS REQUIRED:
ModelSim tool
ALGORITHM:
STEP1
STEP2
STEP3
STEP 4
RESULT
The 4-bit parallel adder circuit designed using VHDL Programming in ModelSim and
verified its output successfully
EX NO: 6
PARALLEL SUBTRACTOR
DATE:
AIM:
To write a program to perform 4-bit Parallel binary Subtractor using VHDL
programming.
COMPONENTS REQUIRED:
ModelSim tool
ALGORITHM:
STEP1
STEP2
STEP3
STEP 4
RESULT
The 4-bit parallel Subtractor circuit designed using VHDL Programming in ModelSim
and verified its output successfully
void main()
{
while(1)
{
P2 = 0x00;
delay();
P2 = 0xff;
delay();
}
OUTPUT
EX NO: 7
DATE:
AIM:
To write a C program to perform flash the output with delay operation using keil
version.
COMPONENTS REQUIRED:
keil version.tool
ALGORITHM:
STEP1
STEP2
STEP3
STEP 4
RESULT
The flashing of the output with delay function using keil c tool was performed and
verified its output successfully
/*ROTATE RIGHT */
#include<reg51.h>
#include<intrins.h>
void main()
{
char a,b ;
a=0xA5;
P0=a;
b=cror_(a,1);
P1=b;
OUTPUT
INPUT DATA=0XA5
OUPUT DATA=0XD2
EX NO: 7
DATE:
AIM:
To write a C program to perform rotate right the input with delay operation using keil
version.
COMPONENTS REQUIRED:
keil version.tool
ALGORITHM:
STEP1
STEP2
STEP3
STEP 4
RESULT
The rotate right of the input with delay function using keil c tool was performed and
verified its output successfully
/*ROTATE RIGHT */
#include<reg51.h>
#include<intrins.h>
void main()
{
char a,b ;
a=0xA5;
P0=a;
b=crol_(a,1);
P1=b;
OUTPUT
INPUT DATA=0XA5
OUPUT DATA=0X4B
EX NO: 9
DATE:
AIM:
To write a C program to perform rotate left the input with delay operation using keil
version.
COMPONENTS REQUIRED:
keil version.tool
ALGORITHM:
STEP1
STEP2
STEP3
STEP 4
RESULT
The rotate left of the input with delay function using keil c tool was performed and
verified its output successfully
EX NO: 9
CODE LOCKING
DATE:
AIM:
To write a C program to perform code locking operation using keil version.
COMPONENTS REQUIRED:
keil version.tool
ALGORITHM:
STEP1
STEP2
STEP3
STEP 4
CODE LOCKING
#include <reg51.h>
#include <stdio.h>
#define OLEN 8
#define
ILEN 8
bit sendfull;
bit sendactive;
// read character
}
else {
sendactive = 0;
}
}
}
/*
* Function to initialize the serial port and the UART baudrate.
*/
void com_initialize (void) {
istart = 0;
iend = 0;
ostart = 0;
oend = 0;
sendactive = 0;
sendfull = 0;
TMOD |= 0x20;
// start timer 1
SCON = 0x50;
ES = 1;
sendactive = 1;
SBUF = c;
}
else {
ES = 0;
update
outbuf[oend++ & (OLEN-1)] = c;
}
}
}
while (sendfull);
putbuf (0x0D);
}
while (sendfull);
putbuf (c);
return (c);
}
char _getkey (void) {
char c;
while (iend == istart) {
;
}
ES = 0;
update
c = inbuf[istart++ & (ILEN-1)];
ES = 1;
return (c);
}
while (1) {
char c;
c = getchar ();
if (c=='a')
{
printf ("\n code correct \n"); }
else
{
printf ("\n code not correct and locked \n");
}
}
}
OUT PUT
RESULT
The code locking operation using keil c tool was performed and verified its output
successfully
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity fs is
Port (a, b, c : in STD_LOGIC;
diff ,br: out STD_LOGIC);
end fs;
architecture Behavioral of fs is
begin
diff <=(a xor b) xor c;
br <= ((not a)and b)or(b and c) or ((not a) and c);
end Behavioral;
FULL SUBTRACTOR
EX NO: 11
DATE:
AIM:
To Design a Full Subtractor using VHDL programming in Xilinx ISE
COMPONENTS REQUIRED:
Xilinx ISE ,FPGA kit
ALGORITHM:
STEP1
STEP2
STEP3
STEP 4
RESULT
The Full Subtractor circuit has been performed by VHDL programming and
synthesized it with Spartran 3E kit and verified its output Successfully.