Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3936864
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:59:59+00:00 2026-05-19T23:59:59+00:00

I am trying to make a ROM in VHDL language, I am using this

  • 0

I am trying to make a ROM in VHDL language, I am using this template I found on http://www.edaboard.com/thread38052.html :

library ieee;
use ieee.std_logic_1164.all;

entity ROM is
port ( address : in std_logic_vector(3 downto 0);
     data : out std_logic_vector(7 downto 0) );
end entity ROM;

architecture behavioral of ROM is
type mem is array ( 0 to 2**4 - 1) of std_logic_vector(7 downto 0);
constant my_Rom : mem := (
0  => "00000000",
1  => "00000001",
2  => "00000010",
3  => "00000011",
4  => "00000100",
5  => "11110000",
6  => "11110000",
7  => "11110000",
8  => "11110000",
9  => "11110000",
10 => "11110000",
11 => "11110000",
12 => "11110000",
13 => "11110000",
14 => "11110000",
15 => "11110000");
begin
process (address)
begin
 case address is
   when "0000" => data <= my_rom(0);
   when "0001" => data <= my_rom(1);
   when "0010" => data <= my_rom(2);
   when "0011" => data <= my_rom(3);
   when "0100" => data <= my_rom(4);
   when "0101" => data <= my_rom(5);
   when "0110" => data <= my_rom(6);
   when "0111" => data <= my_rom(7);
   when "1000" => data <= my_rom(8);
   when "1001" => data <= my_rom(9);
   when "1010" => data <= my_rom(10);
   when "1011" => data <= my_rom(11);
   when "1100" => data <= my_rom(12);
   when "1101" => data <= my_rom(13);
   when "1110" => data <= my_rom(14);
   when "1111" => data <= my_rom(15);
   when others => data <= "00000000";
 end case;
  end process;
  end architecture behavioral;

Well, the problem is that I want to put in my ROM 2000 values. So I was wondering how to make the next using python:

Imagine you have in a .txt file this data in the next format:

0  45
1  56
2  78
3  98

So the program would do this with the data:

0 => "00101101"
1 => "00111000"
2 => "01001110"
3 => "01100010"

Well these values “00101101”,”00111000″,”01001110″,”01100010″ are the respectives values for the binary representation of 45,56,78 y 89.
So, you get the idea…

There is a small detail, it is needed to specify the number of bits for the representation:
If you don´t you could get this:

0 => "101101"
1 => "111000"
2 => "1001110"
3 => "1100010"

Thank you so much to all possible pieces of code to do this program

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T23:59:59+00:00Added an answer on May 19, 2026 at 11:59 pm
    for line in open('your_file.txt'):
        s = line.strip().split("  ") # two spaces are for split
        p = '{} => "{:0{min_bits}b}"'.format(s[0], int(s[1]), min_bits=10)
        print p
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make use of JQuery's remove attribute like this: $('#rom-img_1').removeAttr('mouseover'); $('#rom-img_2').removeAttr('mouseout');
Trying to make a Grid Like this using java and I'm assuming a 2d
im trying make one replace in string from a array but this dont work
Trying to make this simple applet - the first part just creates a simple
Im trying to make a universal parser using generic type parameters, but i can't
I've been banging my head against a wall trying make this work for a
Trying to make infoWindows a little less uglier I found out that the infoWindows
Im trying to make a recreation of MSWord using WPF RichTextBox and Toolbar, so
In trying to make my Javascript unobtrusive, I'm using onLoad s to add functionality
I'm trying make some stuff in jQuery using ASP.NET. But the ID from runat=server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.