Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Port Mapping between PC and ROM as instruction memory in risc processor

Status
Not open for further replies.

kajay

Newbie level 1
Joined
Dec 29, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,287
Homework for designing risc processor. I have 16 bit PC like this

Code:
signal pc_din, PC, pc_rel, pc_dir, pc_inc : std_logic_vector(15 downto 0); -- pc datapath
pc_inc <= pc + 1;
pc_dir <= pc(15 downto 13) &  ADD;
pc_rel <=  pc_inc + ext(15 downto 0);

Mux for PC source is

Code:
with PCSrc select
pc_din <= A when from_A,
pc_rel when from_pcrel,
pc_dir when from_pcdir,
pc_inc when from_pcinc,
(others=>'-') when others;

I have LPM generated 16 by 256 single port ROM for instruction memory

Code:
component mem
PORT(
address : IN STD_LOGIC_VECTOR (7 DOWNTO 0);
clock   : IN STD_LOGIC ;
q   : OUT STD_LOGIC_VECTOR (15 DOWNTO 0)
);
end component;

PC register port map is

Code:
pc_reg: reg Port map (clk=>clk, rst=>rst, D=>pc_din, Q=>PC, we=>ldPC);

Now the question is how can i port map the mem component because pc is 16 bit and address is 8 bit

Code:
rom: mem port map(address=>???, clock=>clk, q=>instr_din);
 

Two options:

- Ignore the upper 8 bits of PC, which will make the same ROM appear at every 256 bytes.
- Decode the upper 8 bits of PC and only enable your ROM when the correct value (e.g. zero) is matched. If you have any other memories or memory mapped devices connected to the address bus, I presume you'll already have a MUX that could be used for this purpose.

Option 1 is generally fine as long as nothing else shares the address space.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top