logo

VHDL Assignment: Register File Implementation in VHDL

Write and test a VHDL entity to model a register file and submit the VHDL source files along with a report documenting the system structure.

4 Pages928 Words211 Views
   

Added on  2023-04-20

About This Document

This VHDL assignment focuses on the implementation of a Register File using a bottom-up approach. It covers the design of memory elements, control circuits, and multiplexers. The code sections and testbench for verification are also provided.

VHDL Assignment: Register File Implementation in VHDL

Write and test a VHDL entity to model a register file and submit the VHDL source files along with a report documenting the system structure.

   Added on 2023-04-20

ShareRelated Documents
VHDL Assignment
Register File implementation in VHDL
The system is developed using bottom up approach. The memory element is the basic unit
that is required for implementation of the Register File. The design starts with a positive
edge triggered D flip flop with asynchronous set-reset capability. These are stacked together
to form a 32 bit register unit. Register unit uses a common enable signal to load all 32 D flip
flops. But data input is connected such that different bits are input to different flip flops.
Other control signals are same to all D flip flop units.
8 of such registers are instantiated inside a Register file for 8X 32 implementation. Apart
from registers, some control circuits are needed to route data in and out of registers based
on address. Decoder is required at the input side of register file to enable a particular
register write. This forms the write port of the register file along with 32 bit data input bus.
A set of mux is required at the output to select data from one of the available 8 registers.
Two mux are required as we need to two read ports at the output. Select lines Rs and Rt
decide the register whose output is made available as Mux output.
The diagram explains the ports and interconnections of the implementation of the design.
Figure 1Register File Components
VHDL Assignment: Register File Implementation in VHDL_1
Looking at Registers in detail, each register is enabled by a single bit output from Decoder.
Only one of registers is selected for write operation at any given time. Allowing RdData to be
latched into that particular
register unit. The generate
statement in the RegFile unit
allows for generic method of
designing the register file with any
number of bits. Index variable n
allows for compile time binding of
data inputs to D flipflop instances
and similarly the Q output of flip
flops are connected to
corresponding data bit position in
the output
Decoder unit can be implemented using if-else blocks using a series of statements. But we
chose the case statement method. Using If-else statement would have built a priority in the
decoding of inputs causing a long chain of gates before output could be generated. Using
case statement allows generation of parallel AND gate implementation. Another feature
used is
BEGIN
G1 : FOR n IN (31) DOWNTO 0
GENERATE
Regbit:DFlipFlop port map
(Clock=> Clock,
Set => '0',
Reset => Reset,
Enable => Enable,
D =>Din(n),
Q =>Qout(n));
END GENERATE G1;
case Rd is
when "000" => DecodeOut <= "0000000" & RegWrite;
when "001" => DecodeOut <= "000000"& RegWrite & "0";
when "010" => DecodeOut <= "00000"& RegWrite & "00";
when "011" => DecodeOut <= "0000"& RegWrite & "000";
when "100" => DecodeOut <= "000"& RegWrite & "0000";
when "101" => DecodeOut <= "00"& RegWrite & "00000";
when "110" => DecodeOut <= "0"& RegWrite & "000000";
when "111" => DecodeOut <= RegWrite & "0000000";
when others => DecodeOut <= "00000000";
end case;
Code Section: RegFile unit
VHDL Assignment: Register File Implementation in VHDL_2

End of preview

Want to access all the pages? Upload your documents or become a member.