473,508 Members | 2,255 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

data bus model...

Hello All,

I have some basic questions regarding the implementation of a data bus
model in a simulator.

Its hard for me to realize how to model something of that sort in a
simulator..suppose I need to model a 200mhz bus and contention on
it..for data coming from memory.

I copied fraction of code that does this..but I am not sure if it does
what it is supposed to do..I have limited knowledge in modelling such
implementations..I will be grateful if anybody could guide me in this
manner..

#define BOUND_POS(N) ((int)(MIN(MAX(0, (N)), 2147483647)))
data_bus_width = 8; //8 bytes
req_size = 6;

data_bus_access(){
bus_cycles = (req_size + data_bus_width - 1) * (0.2) *
(multiplier) / data_bus_width;

//used 0.2 above for 200mhz

busy_until = req_time + (bus_cycles);
busy_until += BOUND_POS(bus_free - (req_time + busy_until));
total_bus_cycles += (bus_cycles);

bus_free = max(bus_free, (req_time + busy_until)) + 1;

}

return (busy_until - req_time); //has to return bus delay for this
access..
}

any suggestions or corrections in this regard will help me a lot..
thanks in advance...

yaduraj
Nov 14 '05 #1
1 2177
Hello dandelion,

Thanks so much for your reply...

I understand what you are saying ..

"dandelion" <da*******@meadow.net> wrote in message news:<41*********************@dreader17.news.xs4al l.nl>...
"yaduraj" <ya******@yahoo.com> wrote in message
news:36**************************@posting.google.c om...
Hello All,

I have some basic questions regarding the implementation of a data bus
model in a simulator.

Its hard for me to realize how to model something of that sort in a
simulator..suppose I need to model a 200mhz bus and contention on
it..for data coming from memory.
Think of bus-speed in a simulator not in terms of Mhz but of (say) MBogoHz.
That is, *you* (and not the SI) determine how long one bus-cycle takes in
actual seconds. Simulated time itself is no more than a counter (if I were
you i'd think about making that at least a 64 bit counter, btw).

This will enable you to "single step" in simulated "time" and make your
simulator more usefull.
I copied fraction of code that does this..but I am not sure if it does
what it is supposed to do..I have limited knowledge in modelling such
implementations..I will be grateful if anybody could guide me in this
manner..

#define BOUND_POS(N) ((int)(MIN(MAX(0, (N)), 2147483647)))


Consider writing binary constant in hex.
0x7FFFFFFF is easyer to remember (and transform into actual bits) than
2147483647.
data_bus_width = 8; //8 bytes
req_size = 6;

data_bus_access()


I think you'd like to provide the bus input (the actual request) as a
argument
to this function. For instance

data_bus_access(char* value)

furthermore, you do not simply *acces* a bus, you either read from it or
write to it. The difference is significan since a bus can be connected to
any number of peripheral devices. All of them can read at the same time from
the same bus, but only one of them can write to it.


The bus access function in my case is freed of deciding the order of
operations..there is another function that just feeds reads and writes
to the bus access function..there can be a number of requests that go
in the same cycle to the bus.
If two (or more) devices attempt to write to the bus "simultaneously"
(within one cycle) the result is a "bus-conflict" or "bus-collision". It
would be desirable to catch this if you are writng a simulator.

On the other hadn, if you are reading from a bus, and no device wrote to it,
the data you'd get would be less than exactly what you'd desire. It would be
convenient to catch this situation aswell.

So you'd have

* a struct containing the data about the bus

struct bus_s
{
char bus_data[BUS_WIDTH]; /* containing the data currently on the bus
*/
unsigned long device_id; /* the device which wrote the data
*/
};

* and three functions:

bus_write(struct bus_s* bus, unsinged int device_id, char* data);

which will set a value and set the device_id, but only if and only if the
device_id is not set (or set to some value designated NO_DEVICE). Otherwise,
it will generate an diagnostic message.

bus_read(struct bus_s* bus, char* data);

which will get a value , but only if and only if the device_id is set.

bus_clear(struct bus_s*);

which simply clears the device id and prepares the bus_s structure for the
next write.
bus_cycles = (req_size + data_bus_width - 1) * (0.2) *
(multiplier) / data_bus_width;

//used 0.2 above for 200mhz
The actual "frequency" in a simulator (as mentioned above) is very hard to
guarantee. The 200Mhz,
when running your simulator, will almost certainly not be 200Mhz, since your
processor will have other tasks running in the background. Switch to an
explicit "simulated time" (the counte mentioned above) and just define one
'tick' to be 1/F "seconds", where F is your "clock-frequency" (the simulated
one).

this helps me..

The logic of the calculation above escapes me. If you are using a 64 bit bus
(as you indicate), 64
bytes *will* be transmitted at a time. So request len is not really a factor
in the bus-busy time.

Each request can be different in size..for instance one request can be
6 bytes and one can be 2 bytes so I was using the req size in the
simulator..what I more interested is modelling this contention and
situations when bus can be busy and the next request has to wait for
some time until the bus is freed..this is where I am faltering ..any
inputs on this.I will be grateful..
Thanks
Regards
Yaduraj
HTH,

Regards,

dandelion (... who once wrote something simular... )

Nov 14 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3327
by: Abhijit | last post by:
I am working in a data warehousing environment which gets sourced from Oracle ERP (AR/GL/AP). The dimensional entities associated with incoming data are GL Code (e.g. 110), Department (e.g. 1050),...
0
4784
by: Redd | last post by:
The following is a technical report on a data modeling project that was recently assigned to me by my professor. I post it so that anyone else who is studying databases and data modeling can have...
16
2989
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
5
2117
by: Kevin C | last post by:
I was curious to know what some developers out in the industry are doing when it comes to exposing Data access logic, specifically persistence. This is assuming that your not using an O/R framework...
41
4631
by: laimis | last post by:
Hey guys, I just recently got introduced to data mappers (DTO mapper). So now I have a SqlHelper being used by DTOMapper and then business layer is using DTOMapper when it needs to persist...
8
9198
by: Richard Collette | last post by:
When attempting to debug a webservice, I get the error: Cannot serialize member System.Exception.Data of type System.Collections.IDictionary, because it implements IDictionary. In reading...
0
2018
by: nicomp | last post by:
I created a Web Service: I imported System.Data.SqlClient so I could access SQL server tables programmatically. The web service builds and deploys with no problems. When I try to add the...
18
22372
by: robert | last post by:
Is there a ready made function in numpy/scipy to compute the correlation y=mx+o of an X and Y fast: m, m-err, o, o-err, r-coef,r-coef-err ? Or a formula to to compute the 3 error ranges? ...
7
1549
by: emre esirik(hacettepe computer science and enginee | last post by:
I used a structer in this program. typedef struct _guitar { int serial; :serial of item at the guitar store int price; :price of item at the guitar...
8
3052
by: Brock | last post by:
I am trying to populate a Crystal Report from data in my DataGrid. The reason for this is that I want the user to be able to change values without updating the database, but still have their report...
0
7229
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7129
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7333
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7398
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5637
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3208
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.