Microcontrollers in Fpgas: Tomas Södergård University of Vaasa
Microcontrollers in Fpgas: Tomas Södergård University of Vaasa
Microcontrollers in Fpgas: Tomas Södergård University of Vaasa
Tomas Sdergrd
University of Vaasa
Contents
Moore Machine
Output only dependent on current state (Pedroni: 2004:
159)
Mealy Machine
Output dependent on current state and external input.
Synchronisation (Zwolinski 2000: 82)
Clock
Reset
Programmable state machine
General purpose FSM (Meyer-Baese 2007: 537, Chu 2008:
324-326)
Programmable state machine
Control
Program
Memory
Data
ALU
Memory
Instructions
Operations
Code example:
Push #5
Push #3
Add
Pop Reg1
Code example
Load #5
Add #3
Store Reg1
Code examples
Move Reg1, #5 Move Reg2, #5
Add Reg1, #3 Move Reg1, #3
Add Reg1, Reg2
Code examples
Move Reg2, #5 Add Reg1, #5, #3
Move Reg3, #3
Add Reg1,Reg2,Reg3
Entity reg_file IS
generic (W: integer:=7;
N: integer :=15);
port(clk, reg_ena : in std_logic;
data : in std_logic_vector(W downto 0);
rd, rs, rt : in integer range 0 to 15;
s, t : out std_logic_vector(W downto 0));
End;
VHDL registry file example
Architecture: type declarations (Meyer-Baese 2007: 560)
Mux: Process
Begin
wait until clk=1;
if rd>0 then
r(rd)<=data;
end if;
End Process Mux;
VHDL registry file example
Demux: Process(r,rs,rt)
Begin
if rs>0 then
s<=r(rs);
else
s<=(others=>0);
end if;
if rt>0 then
t<=r(rt);
else
t<=(others=>0);
end if;
End Process Demux;
FSM vs PSM (Chu:2008:324)
FSM PSM
(Chu 2008: 323, 326-327, 329, 332-337 Altera Nios II/e, Altera Nios II/f, Altera 2011:
3,11-12, Atmega328P: 1, 8, Moshovos 2007)
Recently developed MCU
Area optimisation
Algorithms like FFT may consume less resources, but will hence
become slower. (Meyer-Baese 2007: 537)
Main purpose of FPGA technology is processing speed?
Reuse of code
Controller and datpath partitioning (Zwolinski 2000: 160)
General vs special purpose state machine (Chu 2008: 324)
Complexity
Moves some of the complexity of VHDL (or Verilog) to the compiler
Conclusions Useful technology?
Speed
No parallism anymore
Backwards development?
Zwolinski, Mark (2000). Digital System Design with VHDL. 2. Edition. Essex: Pearson
Education Limited.