electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

Need Help in Parallel to Serial VHDL module


Post new topic  Reply to topic    EDAboard.com Forum Index -> PLD, SPLD, GAL, CPLD, FPGA Design -> Need Help in Parallel to Serial VHDL module
Author Message
missbirdie



Joined: 21 May 2008
Posts: 35
Location: Egypt


Post10 Jun 2008 22:47   

parallel to serial vhdl


Hello
I have a question about the following VHDL code to convert from parallel to serial:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity PAR2SER is
Port ( DIN : in STD_LOGIC;
MODE : in STD_LOGIC;
CLK : in STD_LOGIC;
RESET : in STD_LOGIC;
SDOUT : out STD_LOGIC);
end PAR2SER;

-- purpose: Implement main architecture of PAR2SER

architecture BEHAVIOR of PAR2SER is

signal IDATA : std_logic_vector(7 downto 0); -- internal data

begin -- BEHAVIOR

-- purpose: Main process

process (CLK, RESET)
begin -- process
-- activities triggered by asynchronous reset (active high)
if RESET = ’1’ then
SDOUT <= ’0’;
IDATA <= "00000000";

-- activities triggered by rising edge of clock

elsif CLK’event and CLK = ’1’ then
case MODE is
when "00" => -- no operation
null;
when "01" => -- load operation
IDATA <= DIN;
when "10" => -- shift left
SDOUT <= IDATA(7);
for mloop in 6 downto 0 loop
IDATA(mloop+1) <= IDATA(mloop);
end loop; -- mloop
when others => -- no operation otherwise
null;
end case;
end if;
end process;
end BEHAVIOR;

I may sound silly but what's the mode pin for ??
Back to top
Google
AdSense
Google Adsense




Post10 Jun 2008 22:47   

Ads




Back to top
FvM



Joined: 22 Jan 2008
Posts: 5156
Helped: 767
Location: Bochum, Germany


Post11 Jun 2008 8:11   

parallel to serial shift register vhdl


The author apparently regarded it useful to control serializer operation with a mode input. There are other options, too. You have to know your requirements.

But the code has a syntactical error, cause mode input is a single std_logic bit but used as a vector. It can't compile as is.
Back to top
mmarco76



Joined: 04 Jan 2008
Posts: 85
Helped: 6


Post11 Jun 2008 13:30   

parallel to serial vhdl code


True what FvM says.
Moreover I've to tell you that this is a very bad way of code VHDL.
The construct FOR shall never being used: that's not "C".

You can do in a lot of different manner, the better I think is instantiate a counter and use a shift register.
In VHDL you've to figure out what are you realizing with the Flip Flop.
Back to top
FvM



Joined: 22 Jan 2008
Posts: 5156
Helped: 767
Location: Bochum, Germany


Post11 Jun 2008 18:40   

serial to parallel vhdl


The for loop in this place is OK, it's just another (long winded) way to write a shift register. This is the same function in a single line:
Code:
IDATA(7 downto 1) <= IDATA(6 downto 0);
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> PLD, SPLD, GAL, CPLD, FPGA Design -> Need Help in Parallel to Serial VHDL module
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
Help needed.. parallel to serial converter in VHDL (3)
Parallel to Serial converter.. need help (1)
Need help about controlling the serial/parallel port!!! (3)
Verilog/VHDL codes for parallel to serial and vice versa (4)
parallel in, serial out with pic16f628? help (1)
Help me with the code_ parallel to serial converter... (2)
How to do serial to parallel/parallel conversion in simulink (5)
parallel FFT in VHDL. help me (3)
Help needed in Parallel CRC implementation in VHDL(urgent) (4)
instnciate a VHDL module into a verilog hierarchy help!!!!!! (8)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS