Library Ieee Use Ieee - STD - Logic - 1164.all : Zero One Two Three
Library Ieee Use Ieee - STD - Logic - 1164.all : Zero One Two Three
rst
library ieee;
use ieee.std_logic_1164.all;
entity soal1 is
port(
clk : in std_logic;
rst : in std_logic;
d
: in std_logic;
: out std_logic
);
end soal1;
one
two
three
begin
stateInit: process(rst,clk)
begin
if rst = '1' then
statekini <= zero;
elsif rising_edge(clk) then
statekini <= stateberikut;
end if;
end process;
q <= '0';
if d = '1' then
stateberikut <= two;
else
stateberikut <= zero;
end if;
end case;
end process;
end beh_FSM;
add_imm
outmux1[15..0]
Add0
SEL
16' h2000 --
imm[15..0]
DATAA
outmux3[15..0]
A [1 5..0 ]
OUT0
DATAB
B [1 5..0 ]
DATAB
ADDER
MUX21
sel_a
outmux2[15..0]
outFF[15..0]
SEL
DATAA
PRE
OUT0
Q
16' h0000 --
ENA
MUX21
CLR
SEL
DATAA
a[15..0]
DATAB
OUT0
MUX21
outor
sel_imm
clk
reset_n
en
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity soal2 is
port (
clk
: in std_logic;
reset_n
: in std_logic;
en
: in std_logic;
add_imm
: in std_logic;
imm
addr[31..0]
sel_a : in std_logic;
sel_imm
: in std_logic;
begin
mux1:process(add_imm,imm)
begin
if add_imm ='1' then
outmux1 <= imm;
else
outmux1 <= imm_add;
end if;
end process;
mux2:process(imm, a, sel_a)
begin
if sel_a ='1' then
outmux2 <= a;
else
outmux2 <= imm;
end if;
end process;
mux3: process(outor,outmux2,outadder)
begin
if outor = '1' then
outmux3 <= outmux2;
else
outmux3 <= outadder;
end if;
end process;
-- adder:
outadder <= outmux1 + outFF;
-- logic_or:
outor <= sel_a or sel_imm;
-- output
addr <= outFF & FFadd;
end beh_PC;
Mux0
outand[7]
SEL[7..0]
B[7..0]
FOUT[7..0]~reg0
PRE
DATA[255..0]
A[7..0]
OUT
Add0
A [7 ..0 ]
8' h01 --
CN[7..0]
B [7 ..0 ]
+
ADDER
outand[6]
MUX
Mux1
SEL[7..0]
DATA[255..0]
ENA
OUT
MUX
Mux2
outand[5]
SEL[7..0]
DATA[255..0]
OUT
MUX
Mux3
outand[4]
SEL[7..0]
DATA[255..0]
OUT
MUX
Mux4
outand[3]
SEL[7..0]
DATA[255..0]
OUT
MUX
Mux5
outand[2]
SEL[7..0]
DATA[255..0]
OUT
MUX
Mux6
outand[1]
SEL[7..0]
DATA[255..0]
OUT
MUX
Mux7
outand[0]
SEL[7..0]
OUT
CLR
FOUT[7..0]
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity soal3 is
port(
CN
clk
: in std_logic;
-- logic and
outand <= A and B;
flipflop:process(clk,F)
begin
if rising_edge(clk) then
FOUT <= F;
end if;
end process;
end beh_circuit;
Mux0
anb
a
b
0
0
SEL[1..0]
c
d
4' h6 --
DATA[3..0]
MUX
library ieee;
use ieee.std_logic_1164.all;
entity soal4 is
port(
a
: in std_logic;
: in std_logic;
: in std_logic;
OUT
: in std_logic;
: out std_logic
);
end soal4;
: std_logic;
signal ynd
signal anb
: std_logic;
begin
end beh_CSA;
soal no 4
Mux0
aorb
a
b
0
0
SEL[1..0]
c
d
4' h6 --
DATA[3..0]
MUX
library ieee;
use ieee.std_logic_1164.all;
entity soal4 is
port(
a
: in std_logic;
: in std_logic;
: in std_logic;
: in std_logic;
: out std_logic
);
end soal4;
: std_logic;
OUT
aorb <= a or b;
y <= '0' when c ='1' else
aorb;
end beh_CSA;
soal 5
Mux3
y2y1[1..0]
SEL[1..0]
4' h8 --
DATA[3..0]
0
OUT
reg_e[7]~7
enable_e
reg_c[7]~7
MUX
IO_BUF (TRI)
reg_e[6]~6
Mux2
IO_BUF (TRI)
SEL[1..0]
4' h2 --
DATA[3..0]
IO_BUF (TRI)
OUT
reg_e[5]~5
reg_c[6]~6
MUX
IO_BUF (TRI)
IO_BUF (TRI)
reg_e[4]~4
reg_c[5]~5
IO_BUF (TRI)
IO_BUF (TRI)
reg_e[3]~3
reg_c[4]~4
IO_BUF (TRI)
IO_BUF (TRI)
reg_e[2]~2
reg_c[3]~3
IO_BUF (TRI)
IO_BUF (TRI)
reg_e[1]~1
reg_c[2]~2
IO_BUF (TRI)
IO_BUF (TRI)
reg_e[0]~0
reg_d[7]~7
e[7..0]
y0
IO_BUF (TRI)
0
1
enable_d
reg_c[1]~1
c[7..0]
IO_BUF (TRI)
reg_d[6]~6
IO_BUF (TRI)
reg_c[0]~0
Mux1
IO_BUF (TRI)
reg_d[5]~5
IO_BUF (TRI)
SEL[1..0]
4' h4 --
DATA[3..0]
OUT
reg_b[7]~7
IO_BUF (TRI)
reg_d[4]~4
IO_BUF (TRI)
MUX
reg_b[6]~6
IO_BUF (TRI)
reg_d[3]~3
IO_BUF (TRI)
reg_b[5]~5
IO_BUF (TRI)
reg_d[2]~2
IO_BUF (TRI)
reg_b[4]~4
IO_BUF (TRI)
reg_d[1]~1
IO_BUF (TRI)
reg_b[3]~3
IO_BUF (TRI)
reg_d[0]~0
IO_BUF (TRI)
reg_b[2]~2
IO_BUF (TRI)
IO_BUF (TRI)
reg_b[1]~1
b[7..0]
IO_BUF (TRI)
reg_b[0]~0
Mux0
IO_BUF (TRI)
SEL[1..0]
4' h8 --
DATA[3..0]
MUX
OUT
reg_a[7]~7
IO_BUF (TRI)
reg_a[6]~6
IO_BUF (TRI)
reg_a[5]~5
IO_BUF (TRI)
reg_a[4]~4
IO_BUF (TRI)
reg_a[3]~3
IO_BUF (TRI)
reg_a[2]~2
IO_BUF (TRI)
data_bus[39..0]
library ieee;
use ieee.std_logic_1164.all;
entity soal5 is
port(
a
: in std_logic;
signal reg_b
signal reg_c
signal reg_d
signal reg_e
begin
--demux1to4
with y2y1 select
enable_a <= '1' when "11",
'0' when others;
with y2y1 select
enable_b <= '1' when "10",
'0' when others;
with y2y1 select
enable_c <= '1' when "01",
'0' when others;
with y2y1 select
demux00 <= '1' when "11",
'0' when others;
--demux1to2
with y0 select
enable_d <= demux00 when '1',
'0' when others;
with y0 select
enable_e <= demux00 when '0',
'0' when others;
data_bus <= reg_a & reg_b & reg_c & reg_d & reg_e;
end beh_buff;