bluespec.com Forum Index bluespec.com
Bluespec Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CReg

 
Post new topic   Reply to topic    bluespec.com Forum Index -> Designing with BSV's Rules, Interfaces, ...
View previous topic :: View next topic  
Author Message
snape



Joined: 23 Jun 2018
Posts: 1

PostPosted: Wed Jul 04, 2018 5:29 am    Post subject: CReg Reply with quote

I have used CReg in my code in the following way:

Vector#(64,Array#(Reg#(Page_4K_status))) vect_reg1_s <-replicateM(mkCRegU(3));

I am unable to call a field from the structure Page_4K_status.
The error shown is:
The expression does not have a field `pg4Ks' because it is not a struct or
interface. Found type:
Array#(Reg#(Common::Page_4K_status))
Back to top
View user's profile Send private message
quark
Site Admin


Joined: 02 Nov 2007
Posts: 495

PostPosted: Mon Jul 09, 2018 6:14 pm    Post subject: Re: CReg Reply with quote

It sounds like you are missing the bracket index for selecting from the Array of Reg interfaces.

You probably have something like this in your code:
Code:
vect_reg1_s[vec_idx].pg4Ks
but you need this:
Code:
vect_reg1_s[vec_idx][creg_idx].pg4Ks

The error message says that you're trying to select the field "pg4Ks" from something which is an Array. Before you can select the field, you first need to select and index of the Array.

Note that the "mkCRegU" module returns an Array of Reg interfaces, which you need to select from:
Code:
module mkExample();
  Reg#(int) crg_x [3] <- mkCRegU (3);

  rule r1;
    crg_x [0] <= crg_x [0] + 1;
  endrule

  rule r2;
    crg_x [1] <= crg_x [1] + 3;
  endrule

  rule r3;
    $display ("%d", crg_x [2]);
  endrule
endmodule

In your case, you have a Vector of Arrays, so you need two indices.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    bluespec.com Forum Index -> Designing with BSV's Rules, Interfaces, ... All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
bluespec.com topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP