Are datapath opcode defines/macros available in C?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ChRe_4711096
Level 4
Level 4
50 replies posted 25 replies posted 25 sign-ins

Follow-up to an earlier question (Can I change the opcode configuration registers of a datapath during runtime? ), but with a slightly different core topic:

Are macros for defining a datapath's opcodes available in C? Something like

CS_ALU_OP__AND | CS_SRCA_A0 | ...(and so on)

That would be much more readable and maintainable than configuring the opcodes in the datapath config tool and then copying binary values over to C.

0 Likes
1 Solution
Ekta_N
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

Hello,

Can you please let me know if you are referring to macros generated in the verilog file of the UDB component as shown in the image below:

pastedImage_0.png

There macros are restricted to the verilog file and cannot be used outside it.

As far as I understand, we do not have macro's for datapath opcodes available in C.

But I will check internally and get back to you on this.

Best Regards

Ekta

View solution in original post

0 Likes
2 Replies
Ekta_N
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

Hello,

Can you please let me know if you are referring to macros generated in the verilog file of the UDB component as shown in the image below:

pastedImage_0.png

There macros are restricted to the verilog file and cannot be used outside it.

As far as I understand, we do not have macro's for datapath opcodes available in C.

But I will check internally and get back to you on this.

Best Regards

Ekta

0 Likes

Yes, I'm referring to those verilog macros and was looking for something similar in C. I didn't expect these to work in C directly, and they don't. But after I looked at the registers TRM again, there's a hint in the descriptions for the bits in UDB_UDBPAIR0_UDBSNG0_DPATH_OPC0:

pastedImage_0.png

Typing these bitfield names in the PSoC Creator editor brings up auto-completion, and it reveals a bunch of defines like this one:

CYVAL_UDB_UDBPAIR_UDBSNG_OPC0_A0_WR_SRC_ALU

I'm not sure if these are intended to be used like I hope they are. There's no trace of these (well, I found none) in the PDL documentation.

0 Likes