Beruflich Dokumente
Kultur Dokumente
Abstract—Before the implementation of the laboratory work, a circuit (IC) chip. The result is a single chip with no external
process of create, compile, and download of a Nios II-based connections to other chips, thus reducing the size and
embedded system is implemented on Altera DE2 board for packaging of the product.
system verification was completed. In this paper, an embedded
system application is written using C++ programming language
This lab also introduces the Altera SOPC Builder (System-
and is run on Nios II-based embedded system. Meanwhile, a
hardware accelerator is designed to do the previous operation. A on-Programmable Chip) to develop a Nios II-based Embedded
system bus interface and firmware device driver of the hardware System using SOPC Builder, Quartus II, and Nios II IDE
accelerator is also designed and is integrated into the Nios II- software. It aims to design the software and hardware partition
based embedded system. (hardware IP core) of an embedded system. It also aims to
perform the design-space exploration between the hardware
and software partition when performing specific computation.
I. INTRODUCTION The performance metric is measured in logic cost and
In today's world, embedded systems are everywhere -- computation cycle count.
homes, offices, cars, factories, hospitals, plans and consumer
electronics. Their huge numbers and new complexity call for a II. METHODOLOGY
new design approach, one that emphasizes high-level tools and This project is divided into two design parts that are,
hardware / software tradeoffs, rather than low-level assembly- software and hardware. The software part is to write a RNG
language programming and logic design. and 32-bits signed multiplication in the embedded system
application using C++ programming language and for the
An embedded system is a system designed to perform one hardware part is to design a mul_coprocessor. After designing
or few dedicated functions which often involve real-time the both parts, they will be downloaded into the Altera DE2
computing. As embedded system is designed only to perform board.
dedicated function(s), engineers can optimize it, reducing the
size and cost of the product. Examples of embedded system
are PDAs, MP3 players, mobile phones, digital cameras, DVD
players, GPS receivers and printers.
CONCLUSION
As conclusion, by doing this lab, we brush up our C
programming language. Besides, get to know more about the
VHDL language and also learned a more proper way to use
HDL language to come out a design. In addition, learned
about the SOPC system although we are unable to finish the
entire lab, but we have learned a lot through this lab session.
The most important thing we get from this lab is we found out
how importance cooperation is, and things cannot be done just
by one without others. Instead of gaining knowledge, we were
gained more on soft skill side. We learn about how to
communicate with each others and the importance of
communication.
REFERENCES
[1] Dr. Mohamed Khalil Hani, “Starter’s Guide to Digital Systems VHDL
& Verilog Design 2nd Edition ,” Pearson Prentice Hall
[2] B. Stephen, V. Zwonko, “Fundamentals of digital logic with vhdl design
2nd ed,” Mc Graw Hill Higher Education, 2005.
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main()
{
short i;
int seed;
int set1[25];
int set2[25];
long long mul[25];
if (rand()%2==1)
{
set1[i]=set1[i]*(-1);
}
if (rand()%2==1)
{
set1[i]=set1[i]*(-1);
}
mul[i]=static_cast<long long>(set1[i])*static_cast<long long>(set2[i]);
cout <<”\n\tx is \t” << set1[i] << “\t and y is \t” << set2[i] << endl;
cout << “\tx multiply y is \t” << mul[i] << endl;
}
return(0);
}
APPENDIX 2
RTL Control Sequence Table
APPENDIX 3
VHDL Codes
64-bit Register
library ieee;
use ieee.std_logic_1164.all;
entity mul_Reg64 is
port (clk, en, rst : in std_logic;
d : in std_logic_vector (63 downto 0);
Q : buffer std_logic_vector (63 downto 0));
end mul_Reg64;
entity mul_shiftLreg64 is
port (d : in std_logic_vector(63 downto 0);
ldsh, en, w, clk, rst : in std_logic;
q : buffer std_logic_vector (63 downto 0));
end mul_shiftLreg64;
entity mul_shiftRreg32 is
port (d : in std_logic_vector (31 downto 0);
ldsh, en, w, clk, rst : in std_logic;
q : buffer std_logic_vector (31 downto 0));
end mul_shiftRreg32;
Convert Block
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_unsigned.all;
entity mul_convert is
port (dataA, dataB : in std_logic_vector (31 downto 0);
outA, outB : buffer std_logic_vector (31 downto 0));
end mul_convert;
entity mul_DU is
port( clk, rst : in std_logic;
in_dataA, in_dataB: in std_logic_vector(31 downto 0);
P : buffer std_logic_vector(63 downto 0);
Psel, ldP, ctrlA, ldA, ctrlB, ldB : in std_logic;
A_tp : out std_logic_vector(63 downto 0);
B_tp :out std_logic_vector(31 downto 0);
dataP_tp : out std_logic_vector(63 downto 0);
z, b0 : out std_logic);
end mul_DU;
architecture DU_arch of mul_DU is
signal Ain, A, sum, dataP : std_logic_vector(63 downto 0);
signal B : std_logic_vector(31 downto 0);
signal zero1 : std_logic;
signal dataA, dataB : std_logic_vector(31 downto 0);
Control Unit
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
begin
fsm_transitions:process (clk, rst) begin
if (rst='1')then
y<=S1;
elsif (clk'event and clk = '0') then
case y is
when S1 => if start = '0' then y <= S1; else y <= S2; end if;
when S2 => if z = '0' then y <= S2; else y <= S3; end if;
when S3 => if start = '0' then y <= S1; else y <= S3; end if;
when others => y <= S1;
end case;
end if;
end process fsm_transitions;
fsm_outputs:process (y,z,b0,start) begin
CtrlVector <= (others=>'0');
done <= '0';
case y is
when S1 => CtrlVector <= "010000"; if start = '0' then CtrlVector <= "011111"; end if;
when S2 =>
CtrlVector <= "000101";
if (z = '0' ) then
if (b0 = '1')
then CtrlVector <= "110101";
else CtrlVector <= "000101“;
end if;
end if;
when S3 => CtrlVector <= "000000"; done <= '1';
when others => CtrlVector <= "------";
end case;
end process;
state <= y;
end fsm;
begin
U_CU:mul_CU port map(clock, reset, start, intb0, intz, done, state, intCtrlVec);
CtrlVector<=intCtrlVec ;
U_DU:mul_DU port map(clock, reset, dataA, dataB, result,
intCtrlVec (5),
intCtrlVec (4),
intCtrlVec (3),
intCtrlVec (2),
intCtrlVec (1),
intCtrlVec (0),
tpA, tpB, tpdataP, intz, intb0);
end MU_arch;
APPENDIX 4
Signed Multiplier Waveform Simulation (Timing)
APPENDIX 5
APPENDIX 6
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
ENTITY MU_interface IS
PORT ( reset : IN STD_LOGIC;
clk : IN STD_LOGIC;
chipselect : IN STD_LOGIC;
address : IN STD_LOGIC_VECTOR (1 DOWNTO 0);
write : IN STD_LOGIC;
writedata : IN STD_LOGIC_VECTOR (63 DOWNTO 0);
readdata : OUT STD_LOGIC_VECTOR 63 DOWNTO 0);
start : OUT STD_LOGIC;
data1 : OUT STD_LOGIC_VECTOR(63 DOWNTO 0);
data2 : OUT STD_LOGIC_VECTOR(63 DOWNTO 0);
result : IN STD_LOGIC_VECTOR (63 DOWNTO 0));
END MU_interface;
end if;
end if;
end process;
END arch;
APPENDIX 7
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
ENTITY MU_avalon IS
PORT ( reset : IN STD_LOGIC;
clk : IN STD_LOGIC;
chipselect : IN STD_LOGIC;
address : IN STD_LOGIC_VECTOR (1 DOWNTO 0);
write : IN STD_LOGIC;
writedata : IN STD_LOGIC_VECTOR (63 DOWNTO 0);
readdata : OUT STD_LOGIC_VECTOR (63 DOWNTO 0)
);
END MU_avalon;
COMPONENT MU_interface IS
PORT ( reset : IN STD_LOGIC;
clk : IN STD_LOGIC;
chipselect : IN STD_LOGIC;
address : IN STD_LOGIC_VECTOR (1 DOWNTO 0);
write : IN STD_LOGIC;
writedata : IN STD_LOGIC_VECTOR (63 DOWNTO 0);
readdata : OUT STD_LOGIC_VECTOR (63 DOWNTO 0);
start : OUT STD_LOGIC;
data1 : OUT STD_LOGIC_VECTOR(63 DOWNTO 0);
data2 : OUT STD_LOGIC_VECTOR (63 downto 0);
result : IN STD_LOGIC_VECTOR (63 DOWNTO 0));
END COMPONENT;
COMPONENT mul_MU IS
PORT ( clock, start : in std_logic;
dataA, dataB : in std_logic_vector(31 downto 0);
result : buffer std_logic_vector(63 downto 0);
reset : in std_logic;
CtrlVector : out std_logic_vector (5 downto 0);
done : out std_logic;
state : out std_logic_vector(1 downto 0);
tpA : out std_logic_vector(63 downto 0);
tpB : out std_logic_vector (31 downto 0);
tpdataP : out std_logic_vector(63 downto 0));
END component;
BEGIN
U_MuUnit: mul_MU
port map ( clock => clk,
dataA => lineA,
dataB => lineB,
start => start_signal,
result => result_MU,
reset => reset
);
U_Interface_MU: MU_interface
port map ( clk => clk,
reset => reset,
chipselect => chipselect,
address => address,
write => write,
writedata => writedata,
readdata => readdata,
result => result_MU,
data1 => lineA(31 downto 0),
data2 => lineB(31 downto 0),
start => start_signal
);
END avalon_arch;