computer-science,computer-architecture , Computer architecture - How to find the addresses in a block

Computer architecture - How to find the addresses in a block


Tag: computer-science,computer-architecture

A cache memory with 4 KiB, each block is 16 words, there are 64 lines in the cache.

Tag = 18

Index = 6

Block offset = 4

Byte Offset = 2

I want to know for block number 448 what is the first address in the block and what is the last address in the block.

I know that in the block there are 16 words, but I don't understand how I can find the last and first addresses.

Any ideas?

Any help will be appreciated!


In your configuration a memory block is made of 16 words. Let me also assume that a word is 4 bytes and the memory is byte addressable.

1 Block = 16 words = 64 bytes

Block numbers usually grow with memory addresses, that is:

 Block       Address Range
Block #0        [0, 63]
Block #1        [64, 127]
Block #2        [128, 191]
  ...              ...
Block #448      [28672, 28735]
  ...              ...

In general, for a block i its address range is [64*i, 64*i-1].


Java: 2d array - making it “torus” like

I am facing following problem: I have a board of size MxN squares. What is the best way to make it in java so that when there are coordinates given which are out of bounds (or with negative values), it will return square from the other side of the board?...

Binary Search vs. Linear Search (data structures & algorithms)

Trying to wrap my head around some basic and common algorithms.. my current understanding of the question is in bold. ( 1 ) Assuming we have a sorted array with n items: at most how many times will a binary search compare elements? I keep seeing ' 0(log(n)) ' pop...

How many words can be in the address space?

Here is the problem I am working on The Problem: A high speed workstation has 64 bit words and 64 bit addresses with address resolution at the byte level. How many words can in be in the address space of the workstation? I defined the different terms in the problem...

What is the term used to describe a complete call frame cycle thing in JavaScript?

In JavaScript, there is the concept of the execution pathway beginning at a certain point (such as an event handler), with the control being relinquished back to the browser at some point. Is there a proper name for this process? Originally I thought you could refer to this as the...

Which are the operands in Lc3 instruction?

I read on Wiki Opcodes that the operand of an Lc3 instruction is the data that the instruction acts on. For this Lc3 instruction (from Lc3 Instructions) Would the operands be both destination register and PCoffset9 or just destination register based off that definition?...

How do people create new programming languages?

I'm novice programmer, learning C. Something that's always confused me is how do people create new programming languages? Sub/related questions: What language do they write it in? Does the language have to be one that in between a high level language and machine code? What are the stages/elements of creating...

sliding window algorithm implementation [closed]

I am having trouble figuring how to derive the numbers to the solution to the question. I am following the steps, however my numbers do not come near that of the solution. Can someone give a concise step by step way to figuring out both problems. Solution ...

How many stack memories will be allocated to a program

I have a program which have 4 projects as dependency for that (that means it has to load 4 dlls to run that program) .Does the OS allocates 4 stack memories or only 1 stack memory will be allocated for whole program and how much stack memory size will be...

Is there a code that results in 50% branch prediction miss?

The problem: I'm trying to figure out how to write a code (C preffered, ASM only if there is no other solution) that would make the branch prediction miss in 50% of the cases. So it has to be a piece of code that "is imune" to compiler optimizations related...

Computer architecture - How to find the addresses in a block

A cache memory with 4 KiB, each block is 16 words, there are 64 lines in the cache. Tag = 18 Index = 6 Block offset = 4 Byte Offset = 2 I want to know for block number 448 what is the first address in the block and what...

Interpretation of perf stat output

I have developed a code that gets as input a large 2-D image (up to 64MPixels) and: Applies a filters on each row Transposes the image (used blocking to avoid lots of cache misses) Applies a filters on the columns (now-rows) of the image Transposes the filtered image back to...

In a forward search algorithm, what happens if both items are equal? [duplicate]

This question already has an answer here: Dijkstra's algorithm: What to do if there are two or more nodes with minimal weight? 1 answer In a forward search algorithm, what do you do if both items are equal? The forward search algorithm stems off of Dijkstra algorithm Forward Search...

Cache calculating block offset and index

I've read several topics about this theme but I could not get the answer. So my question is: 1) How is the block offset calculated? I want to know not the formula but the concept of it. As I know it is quantity of cases which a block can store...

How does LEA instruction store address of A?

This is based off this question LEA instruction Here is the code segment I have a question about .ORIG X3700 LEA R0, A ..... A .FILL X1234 @Paul R, the answer responder, said that "The origin of the code is x3700, and you have 12 instructions, so the address of...

Cache and scratchpad memories

Could someone explain what is the difference between cache memory and scratchpad memory? I'm currently learning about computer architecture.

Are cache-line-ping-pong and false sharing the same?

For my bachelor thesis I have to evaluate common problems on multicore systems. In some books I have read about false sharing and in other books about cache-line-ping-pong. The specific problems sound very familiar, so are these the same problems but given other names? Can someone give me names of...

Encoder and My Challenges on Digital Logic

in following Encoder, the priority of bigger number is bigger. if the initial state is 0, after how many clock pulse, Q after being 1, change states to zero. My professor, say (3), why ?...

How can we prove that the running time bound of an algorithm is tight?

Suppose we can prove that an algorithm, invoked with an input of size n, runs in time O(f(n)). I want to prove that this running time bound is tight. Two questions: Wouldn't it suffice to give a special input and show that the running time is at least f(n)? I've...

Doesn't fragmentation in FAT file system lead to space wastage?

The wikipedia for article for fragmentation states: In many cases, fragmentation leads to storage space being "wasted", and in that case the term also refers to the wasted space itself. For other systems (e.g. the FAT file system) the space used to store given data (e.g. files) is the same...

Continuation in a mainstream-ish programming language [closed]

I need a mainstream language that supports continuations. Java never will (breaks finally), Scala has deprecated it, ruby is silently deprecating it as well... Does any other mainstream, non FP-only language support them and does not plan to deprecate it? I actually need the ability to jump back in the...

Cache memory organization

i would like to understand how the following program works in terms of main memory updating. int main() { short a[256], b[256]; register i; for (i=0 ; i < 256 ; i++) a[i] = i; for (i=0 ; i < 256 ; i++) b[i] = 255 - i; for (i=0...

Where is -32768 coming from?

This is LC3 Assembly code I am working with .ORIG x3000 LOOP LDI R0, KBSR BRzp LOOP From LC3 Assembly, I know that LDI is a load indirect addressing mode, meaning it read in an address stored at an location and then read the value at that location From Lc3...

How do I output a bubble sorted 2-D string array in C?

How do I go about sorting a 2-D string array in C using bubble sort (or any other kind of sorting in that matter) ? What I'm actlly trying to do is as follows : Example: Unsorted 2-D string array : abfg abcd xyzw pqrs orde Sorted 2-D string array:...

find element in linked list

There is a data structure providing iterators with the following interface: struct iterator { T value(); void next(); bool isValid(); } How would you design an algorithm which at the end of the loop returns some value from the list with equal probability for each element? The list can be...

How many nand gates does a computer actually need to operate?

Sorry if this is a noob question, but at first I was thinking that logic gates were much smaller than they actually are: So my question is, how many logic gates (similar to the one above) does a computer actually need to operate? Since this number must be somewhat...

How many bits are in the address field for a directly mapped cache?

This is a question based on Direct Mapped Cache so I am assuming that it's ok to ask here as well. Here is the problem I am working on: The Problem: " A high speed workstation has 64 bit words and 64 bit addresses with address resolution at the byte...

Determine all consecutive subsets of the set {1,2,3,…,n}. The subsets should have at least 2 elements

I need to partition a set S={1, 2, 3, … , n} consisting of consecutive numbers such that each subset has has at least 2 elements (rule 1) and it consists of consecutive numbers (rule 2). The rules are: Each subset has at least two elements. All elements of all...

Big-O Computational Resources

I know that measuring asymptotic complexity can be based on any resources you have, whether it's time, memory usage, number of comparisons, etc. But when it comes to sorting something, I realize we normally associate the asymptotic notation with the basic operations like number of swaps/steps or number of comparisons....

Solving a complex recurrence relation for the Traveling Salesman

I need to solve the exact time complexity for the brute force version of the Traveling Salesman using a recurrence relation. I've worked out the recurrence relation to be as follows: T(n)=T(n-1)*(n-1)+1 But I'm having trouble reducing that that to a closed form of the function, and thus get the...

Keeping Score in python code

What do I have to do in order to have a score board for my code because I need a score board. I tried a while statement but got lost there. Can you help me? So lost. import random def main_menu(): option = input("Play the game (P) , View the...

Can Fibonacci Heap have more than one nodes with equal rank(or value, or key)?

I am studying Fibonacci heap alone, and I came across a question. I know any nodes can be inserted into Fibonacci heap, but what if the rank(or value, or key) of that new node is equal to the sibling node? 1) For example, (1) <-minimum root / \ (3) (5)...

For a Single Cycle CPU How Much Energy Required For Execution Of ADD Command

The question is obvious like specified in the title. I wonder this. Any expert can help?

Shouldn't R3 hold address x3307?

I am doing a practice question from Question 7 Shouldn't the address I highlighted be x3307, not x3308? The way I reasoned this out was that (PC before 2nd instruction) = (PC after 1st instruction). The PC after 1st instruction is x3301. Therefore when the second instruction executes, the PC,...

Compute the “lower contour” of a set of segments in the plane in `O(n log n)`

Suppose you've a set s of horizontal line segments in the plane described by a starting point p, an end point q and a y-value. We can assume that all values of p and qare pairwise distinct and no two segments overlap. I want to compute the "lower contour" of...

Number of Prime Implicant and EPI

My TA solve this problem, Number of Prime Implicant (PI) for f(a,b,c,d)= Sigma m(0,2,4,5,8,10,11,13,15) is 7 and number of Essential PI (EPI) is 1. how this will be calculated? I think it's wrong. any idea? My solution is : ...

Why is `nil` discussed as boolean by treehouse?

Why is nil considered a boolean or represented as a boolean value in the boolean tutorial for ruby? By definition, a boolean in computer science is a: data type, having two values (usually denoted true and false), intended to represent the truth values of logic and Boolean algebra. ...

R Constained Combination generation

Say I have an set of string: x=c("a1","b2","c3","d4") If I have a set of rules that must be met: if "a1" and "b2" are together in group, then "c3" cannot be in that group. if "d4" and "a1" are together in a group, then "b2" cannot be in that group....

first and last terms of a nested loop, sums of arithmetic series starting with non zero index

I have 2 arithmetic series... (i) for i<- 1 to n do for j<- 1 to 2n-i do //a unit cost operation So the first term is 2n-1, last term is 2n-n = n (ii) for i <- 1 to n do for j <- 2 to (n+i) do //...

What does stripping off the ASCII template mean?

I am working on a practice exam problem The Problem On execution of this program, the user inputs two numbers. What is the value of xGuess so we can strip off the ASCII template? Explain. .ORIG x3000 TRAP x23 LD R2, ASCII ADD R1, R2, R0 TRAP x23 ADD R0,...

Would this function be O(n^2log_2(n))?

So I am given a function like 65536 n2 + 128 n log2n and the only way that this would be O(n2 log2n) is if C = 65664, n0 = 2 for all n ≥ 2 since C1 = 65536 n1 = 2 when 65536 ≤ C1*n2 and C2 =...

does Ω(n^5) + o(n^2) + O(logn) = Ω(n^5) [closed]

Hi I have been given this problem, and I have no idea where to start. So any advice what be great. How to you go about this kind of problem? All the information I was given is: State whether the following statement is true or false, justify your answer? Ω(n^5)...

What are the basic steps from a hardware circuit to a transitionssystem

What are the basic steps when I want to get a hardware circuit into a transitionssystem? I don't get the arrows between the nodes. The arrows from/to the same node are simple. But How do I get the arrows between node {r} and node {x,r,y} for example? and what can...

Need workaround to treat float values as tuples when updating “list” of float values

I am finding errors with the last line of the for loop where I am trying to update the curve value to a list containing the curve value iterations. I get errors like "can only concatenate tuple (not "float) to tuple" and "tuple object has no attribute 'append'". Does anyone...

Keyboard events java

I have recently started learning java.I want to make a game like I have made it in c++ once using a simple graphics lib. I have the graphics part down i plan to use small images and use this basic graphics lib.I can't figure out keyboard input i...

Hazard Type - Computer Architecture

what the type of hazard is this WAR,RAW,WAW? LW R2, 0x4000(R30) LW R3, 0x8000(R30) SUB R4, R3, R2 ...

How to properly pass array pointers to function in C

A different question may have been asked about this program, however in this C code I have three functions: one to print records, one to add a record and one to delete a record. What I don't understand is why the (add) and (delete) do not make changes in the...

hardware implementation of Modulo m adder

I have 8 inputs whose modulo sum i have to take with modulus m.i know algorithm for 2 input but it is not working here. eg i have sum=sum0+sum1+sum2+sum3+sum4+sum5+sum6+sum7 and i have to take mod m of sum.How to do this rom hardware implementation point of view? i aslo write...

Why am I getting an “expected register or immediate value” error?

This is my Lc3 Assembly code .ORIG x3000 AND R0,R0, #0 AND R2,R2, #0 ADD R2,R2, #7 JSR SUB ADD R2,R2, ASCII ADD R0,R2,#0 TRAP x21 SUB ADD R2,R2,#9 ADD R7,R7,#1 RET HALT ASCII .FILL x0000 .END When I try to assembly the code, I got these errors I know...

Brick-Breaker in C - incrementing rows of bricks issue

I'm trying to re-create brickbreaker using C and the Stanford Portable Library (SPL). The goal of my initBricks function is to add 5 ROWS of bricks with 10 COLUMNS in each row (50 bricks total). When I run this code my window only has 1 ROW of 10 bricks. For...