Professional Documents
Culture Documents
Computer Architecture Lab Solution(MAKAUT)
Computer Architecture Lab Solution(MAKAUT)
Please contact us on :
Email id : r.rajak@tridenttechlabs.com
Cell no : 9007106735
Overview
[1]
Table of Content
..................................................................................................................................... 5
..................................................................................................................................... 21
[2]
1. BASIC DIGITAL LOGIC BASE PROGRAMMING WITH
HDL
use ieee.std_logic_1164.all;
entity and_gate is
c : out std_logic);
end and_gate;
begin
c <= a and b;
end arc;
DATA FLOW :
[3]
TIMING DIAGRAM :
1.2 OR GATE
CODE:
library ieee;
use ieee.std_logic_1164.all;
entity and_gate is
c : out std_logic);
end and_gate;
begin
c <= a or b;
end arc;
[4]
DATA FLOW:
TIMING DIAGRAM:
[5]
1.3 NAND GATE
CODE:
library ieee;
use ieee.std_logic_1164.all;
entity and_gate is
c : out std_logic);
end and_gate;
begin
c <= a nand b;
end arc;
DATA FLOW:
[6]
TIMING DIAGRAM:
[7]
1.4 NOR GATE
CODE:
library ieee;
use ieee.std_logic_1164.all;
entity and_gate is
c : out std_logic);
end and_gate;
begin
c <= a nor b;
end arc;
DATA FLOW :
[8]
TIMING DIAGRAM:
use ieee.std_logic_1164.all;
entity and_gate is
c : out std_logic);
end and_gate;
begin
c <= a xor b;
end arc;
[9]
DATA FLOW:
TIMING DIAGRAM:
[10]
1.6 XNOR GATE
CODE:
library ieee;
use ieee.std_logic_1164.all;
entity and_gate is
c : out std_logic);
end and_gate;
begin
c <= a xnor b;
end arc;
DATA FLOW:
[11]
TIMING DIAGRAM:
CODE(ADDITION,SUBTRACTION):
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity addsub is
oper: in std_logic;
end addsub;
begin
end archi;
DATA FLOW:
TIMING DIAGRAM:
[13]
CODE (MULTIPLICATION):
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity signed_mult is
port
);
end entity;
begin
result <= a * b;
end rtl;
DATA FLOW:
[14]
TIMING DIAGRAM:
CODE (DIVISION):
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity signed_div is
port
);
end entity;
[15]
begin
result <= a / b;
end rtl;
DATA FLOW :
TIMING DIAGRAM :
[16]
3. 8 BIT REGISTER DESIGN
CODE:
library ieee;
use ieee.std_logic_1164.all;
entity shift_siso is
end shift_siso;
begin
process (Clock)
begin
for i in 0 to 6 loop
end loop;
end if ;
end process;
end behav;
[17]
DATA FLOW:
TIMING DIAGRAM:
[18]
4. MEMORY UNIT DESIGN AND PERFORM MEMORY
OPERATION
CODE:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
USE ieee.numeric_std.ALL;
entity RAM_32X8 is
port(
write_in: in std_logic;
clock: in std_logic;
);
end RAM_32X8;
b"10000000",b"01001101",x"77",x"67",
x"99",x"25",x"00",x"1A",
x"00",x"00",x"00",x"00",
x"00",x"00",x"00",x"00",
x"00",x"0F",x"00",x"00",
x"00",x"00",b"00111100",x"00",
x"00",x"00",x"00",x"00",
x"00",x"00",x"00",x"1F"
);
[19]
begin
process(clock)
begin
if(rising_edge(clock)) then
if(write_in='1') then
end if;
end if;
end process;
end Behavioral;
DATA FLOW:
[20]
TIMING DIAGRAM :
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use ieee.NUMERIC_STD.all;
-----------------------------------------------
-----------------------------------------------
entity ALU is
[21]
generic (
);
Port (
);
end ALU;
begin
process(A,B,ALU_Sel)
begin
case(ALU_Sel) is
ALU_Result <= A + B ;
ALU_Result <= A - B ;
[22]
ALU_Result <= std_logic_vector(to_unsigned((to_integer(unsigned(A)) *
to_integer(unsigned(B))),8)) ;
ALU_Result <= A or B;
if(A>B) then
[23]
ALU_Result <= x"01" ;
else
end if;
if(A=B) then
else
end if;
end case;
end process;
end Behavioral;
[24]
DATA FLOW:
TIMING DIAGRAM :
[25]
6. 8 BIT SIMPLE CPU DESIGN
CODE :
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_unsigned.all;
ENTITY shell IS
PORT (
rxdat : IN std_logic;
xclk : IN std_logic;
rxstb : IN std_logic;
txstb : IN std_logic;
clk : IN std_logic;
rd : BUFFER std_logic;
wr : BUFFER std_logic;
);
END shell;
[26]
ARCHITECTURE one OF shell IS
clk : IN std_logic;
rd : BUFFER std_logic;
wr : BUFFER std_logic;
);
END COMPONENT;
[27]
BEGIN
rd => rd,
wr => wr,
);
-- select ram
ramcs <='0';
txrx: PROCESS
BEGIN
[28]
END PROCESS txrx;
rx: PROCESS
BEGIN
PROCESS
BEGIN
END PROCESS;
[29]
clkdiv(7) WHEN "01000",
END one;
[30]
DATA FLOW :
TIMING DIAGRAM :
[31]
7. INTERFACING OF CPU MEMORY
CODE:
library ieee;
use ieee.std_logic_1164.all;
entity shift_siso is
end shift_siso;
begin
process (Clock)
begin
for i in 0 to 6 loop
end loop;
end if ;
end process;
end behav;
[32]
DATA FLOW :
TIMING DIAGRAM :
[33]