Question

In: Electrical Engineering

VHDL Code will not run simulation. What is the problem with my code?? --VHDL Code library...

VHDL Code will not run simulation. What is the problem with my code??

--VHDL Code

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

entity DataMemory16Bits is
Port ( Address_DM : in STD_LOGIC_VECTOR(15 downto 0);
Data_In_DM : in STD_LOGIC_VECTOR(15 downto 0);
Clock : in STD_LOGIC;
We_DM : in STD_LOGIC;
Re_DM : in STD_LOGIC;
Data_Out_DM : out STD_LOGIC_VECTOR(15 downto 0));
end DataMemory16Bits;

architecture Behavioral of DataMemory16Bits is
Type DataMemory16Bits is array(0 to 31) of STD_LOGIC_VECTOR(15 downto 0);
signal memory: DataMemory16Bits;

begin
process (Address_DM, Clock, We_DM, Re_DM)
begin
Data_Out_DM <= (Others=>'Z');
if (Clock='1')
then
if We_DM='1' and Re_DM='0'
then
Memory(to_integer(unsigned(Address_DM))<= Data_In_DM;
end if;
if Re_DM='1' and We_DM='0'
then
Memory(to_integer(unsigned(Data_In_DM)<= Address_DM;
end if;
if Re_DM='1' and We_DM='1'
then
Data_Out_DM<=Memory(to_integer(unsigned(Address_DM);
else
Data_Out_DM<=(Others=>'Z');
end if;
end if;
end process;
end Behavioral;

Solutions

Expert Solution

-- See cooments with correct code

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

use IEEE.STD_LOGIC_ARITH.ALL;

use IEEE.STD_LOGIC_UNSIGNED.ALL; ---Include this library package

entity DataMemory16Bits is

Port ( Address_DM : in STD_LOGIC_VECTOR(15 downto 0);

Data_In_DM : in STD_LOGIC_VECTOR(15 downto 0);

Clock : in STD_LOGIC;

We_DM : in STD_LOGIC;

Re_DM : in STD_LOGIC;

Data_Out_DM : out STD_LOGIC_VECTOR(15 downto 0));

end DataMemory16Bits;

architecture Behavioral of DataMemory16Bits is

Type DataMemory16Bits is array(0 to 65535) of STD_LOGIC_VECTOR(15 downto 0);

-- Since ----address is 16 bit then locations will be 2*16 = 65536

signal memory: DataMemory16Bits;

begin

process (Address_DM, Clock, We_DM, Re_DM)

begin

Data_Out_DM <= (Others=>'Z');

if (Clock='1' and Clock'event)then --- Memory is always edge triggered. Event trigger causes false data write

if (We_DM='1' and Re_DM='0') then

Memory(conv_integer(Address_DM))<= Data_In_DM; --- use conv function and close brackets were --missing

end if;

if (Re_DM='1' and We_DM='0') then

Memory(conv_integer(Data_In_DM))<= Address_DM; --- use conv function and close brackets were - --missing

end if;

if (Re_DM='1' and We_DM='1')then

Data_Out_DM<=Memory(conv_integer(Address_DM)); --- use conv function and close brackets were --missing

else

Data_Out_DM<=(Others=>'Z');

end if;

end if;

end process;

end Behavioral;

---- Simulation on ModelSim


Related Solutions

Design in VHDL a gray code decoder to excess 3 code Screenshot the simulation and code.
Design in VHDL a gray code decoder to excess 3 code Screenshot the simulation and code.
Design in VHDL a 8-1 Multiplexer Screenshot the simulation and code.
Design in VHDL a 8-1 Multiplexer Screenshot the simulation and code.
Design in VHDL a 16-1 Demultiplexer Screenshot the simulation and code.
Design in VHDL a 16-1 Demultiplexer Screenshot the simulation and code.
Provide the VHDL code and simulation results for a mod-7 counter, with asynchronous active low reset.
Provide the VHDL code and simulation results for a mod-7 counter, with asynchronous active low reset.
Can someone run this in vhdl and send me the output? acreenshot library IEEE; use IEEE.STD_LOGIC_1164.ALL;...
Can someone run this in vhdl and send me the output? acreenshot library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity VHDL_MOORE_FSM_Sequence_Detector is port ( clock: in std_logic; --- clock signal reset: in std_logic; -- reset input sequence_in: in std_logic; -- binary sequence input detector_out: out std_logic -- output of the VHDL sequence detector ); end VHDL_MOORE_FSM_Sequence_Detector; architecture Behavioral of VHDL_MOORE_FSM_Sequence_Detector is type MOORE_FSM is (Zero, One, OneZero, OneZeroZero, OneZeroZeroOne); signal current_state, next_state: MOORE_FSM; begin -- Sequential memory of the VHDL MOORE FSM Sequence...
CAN SOMEONE RUN THIS WITH VHDL AND SEND ME THE OUTPUT? LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY...
CAN SOMEONE RUN THIS WITH VHDL AND SEND ME THE OUTPUT? LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY LFSR8 IS PORT (Clk, Rst: IN std_logic; output: OUT std_logic_vector (7 DOWNTO 0)); END LFSR8; ARCHITECTURE LFSR8_beh OF LFSR8 IS SIGNAL Currstate, Nextstate: std_logic_vector (7 DOWNTO 0); SIGNAL feedback: std_logic; BEGIN StateReg: PROCESS (Clk,Rst) BEGIN IF (Rst = '1') THEN Currstate <= (0 => '1', OTHERS =>'0'); ELSIF (Clk = '1' AND Clk'EVENT) THEN Currstate <= Nextstate; END IF; END PROCESS; feedback <= Currstate(4)...
I have a problem with my code. It does not run. Please can someone check the...
I have a problem with my code. It does not run. Please can someone check the code and tell me where I went wrong? This is the question: Program Specification: Write a C program that takes the length and width of a rectangular yard, and the length and width of a rectangular house (that must be completely contained in the yard specified) as input values. Assuming that the yard has grass growing every where that the house is not covering,...
this is my Matlab code for lemur and plant population simulation. But i didn't get the...
this is my Matlab code for lemur and plant population simulation. But i didn't get the right graph. R(1,1)=35; % Initial pop of males R(2,1)=35; % Initial pop of females P(3,1)=200000; % Iniitial pop of plants r(1)=1.01; % Growth rate of male pop r(2)=1.01; % Growth rate of female pop r(3)=1.10; % Growth rate of plants K(1)=800; % Carrying capacity for male pop K(2)=600; % carrying capacity for female pop K(3)=7500000; % carrying capacity for plants    E=65; % Plants...
Below is my source code for file merging. when i run the code my merged file...
Below is my source code for file merging. when i run the code my merged file is blank and it never shows merging complete prompt. i dont see any errors or why my code would be causing this. i saved both files with male names and female names in the same location my source code is in as a rtf #include #include #include using namespace std; int main() { ifstream inFile1; ifstream inFile2; ofstream outFile1; int mClientNumber, fClientNumber; string mClientName;...
In Python I have a code: here's my problem, and below it is my code. Below...
In Python I have a code: here's my problem, and below it is my code. Below that is the error I received. Please assist. Complete the swapCaps() function to change all lowercase letters in string to uppercase letters and all uppercase letters to lowercase letters. Anything else remains the same. Examples: swapCaps( 'Hope you are all enjoying October' ) returns 'hOPE YOU ARE ALL ENJOYING oCTOBER' swapCaps( 'i hope my caps lock does not get stuck on' ) returns 'I...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT